Jump to content
  • Advertisement
Sign in to follow this  
gamechampionx

Transport Endpoint Not Connected

This topic is 3772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by gamechampionx
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.
Possibly. Make sure you call shutdown() to make sure all the pending data is sent before closing the socket.

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?

Share this post


Link to post
Share on other sites
Shutdown didn't seem to do the trick.

It's failing on the first read. I'm actually using the read method for the time being and the result of something like (val = read(...)) > 0 is false.

The error message results from the perror("read").

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!