Transport Endpoint Not Connected
I'm trying to do a simple socket connection client/server in C and I get this every time I try to do a read.
Client:
-socket
-connect
-send
Server:
-socket
-bind
-listen
-read
There's got to be some important step I'm missing or something. Google was not very much help with this error.
You're missing an accept(). A socket in a listening state is just waiting for connections you can't (I believe) read from it directly, you need to accept() a connection and then recv() from the socket it returns.
The server had the accept thing in there and it returns a positive result.
For some reason, I just keep getting that error.
Might have something to do with the fact that after the write, the client just terminates - not sure if that's an issue.
For some reason, I just keep getting that error.
Might have something to do with the fact that after the write, the client just terminates - not sure if that's an issue.
Quote:Original post by gamechampionxPossibly. Make sure you call shutdown() to make sure all the pending data is sent before closing the socket.
The server had the accept thing in there and it returns a positive result.
For some reason, I just keep getting that error.
Might have something to do with the fact that after the write, the client just terminates - not sure if that's an issue.
And is recv() returning -1 the first time you call it then? Or are you just checking WSAGetLastError() (Or errno) without checking what recv() returns?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement