Computing.Net > Forums > Programming > socket programming, reset by peer

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

socket programming, reset by peer

Reply to Message Icon

Name: shanpril
Date: October 25, 2001 at 07:59:09 Pacific
Comment:

I wrote an internet server socket (SOCK_STREAM) and a client. After a connect() in the client, I wrote a loop to do a send() followed by a recv(), in another word, I'll send a msg, get a reply back from the server, then do it again... 5 times in total. The first time it went OK, but when it looped back, it failed at the recv(). The error is "socket is reset by peer".

Then I changed the code, each time I will do: connect()-send()-recv()-close(), then again...for 5 times. This works fine.

So I am wondering, for a client socket, if it can only recv() once, and I'll have to close it then connect() again to send-recv another msg? It doesn't sound right...



Sponsored Link
Ads by Google

Response Number 1
Name: Mik
Date: October 26, 2001 at 00:09:38 Pacific
Reply:

If you are using a stream socket then you will only have to connect once. Once the connection is built up you can send and receive as much as you want either from the server side or the client side.
I don't know what your code looks like so I can't really guess what's going wrong.
I never use send and recv but they should work just fine. I use read and write.

Mik


0

Response Number 2
Name: yogesh
Date: October 28, 2001 at 22:34:15 Pacific
Reply:

i think this should work fine in loop also..

c if u r making some other mistake..
i have worked with send and recv and these things do work fine...



0

Response Number 3
Name: sandeep
Date: February 26, 2002 at 22:37:52 Pacific
Reply:

sir...

my project is web enable control system ...

i want that whatever data i take the
from the remote sight that shoul be copy on remote sight ..in the same formate so i required socket programming...and code for that can you help me out ..

thanking you

sandeep



0

Response Number 4
Name: sandeep
Date: February 26, 2002 at 22:42:09 Pacific
Reply:

sir...

my project is web enable control system ...in which person who is on the remote sight can operate the equipments through net.

i want that whatever data i take from the
from the remote sight that shoul be copy on server sight ..in the same formate so ican check the operation from the same file and perform the operation so it required socket programming...and code for that can you help me out ..

thanking you

sandeep



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: socket programming, reset by peer

C socket programming in linux www.computing.net/answers/programming/c-socket-programming-in-linux/2462.html

windows socket programming www.computing.net/answers/programming/windows-socket-programming/4211.html

Need Advice\Socket Programming www.computing.net/answers/programming/need-advicesocket-programming/3115.html