Problem with connect()
Hi
I am trying to write a simple client server socket program in C using Internet Domain Sockets. The connect call is failing with the error message- Bad File Descriptor. The server program is running fine(I think). Can someone help me out with this. I am logged in as root when executing the programs. |
It sounds like you didn't check the return value of the socket() call - or that you never even called socket().
To connect: 1. open a socket: socket() 2. fill in an address struct with the destination address (IP and port) 3. make the connection: connect() The socket has to be a stream type; if it is a 'datagram' then connect will fail since connect() only works with streams - which makes sense because a datagram like UDP is a "connectionless" protocol. |
Maybe you could show us the code?
|
hey
Thanks for the help. Unfortunately i deleted the file in frustration, rewrote it and somehow it started working. Now i can't remember what was wrong with it. |
All times are GMT -5. The time now is 01:32 PM. |