Unix Programming - Need Help !! (Socket Programming)

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > May 2005 > Need Help !! (Socket Programming)





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Need Help !! (Socket Programming)
girishdomain@gmail.com

2005-05-18, 2:49 am

Connetion reset by peers (Socket Programming)
in a Clinet Server Model ????

Hi All

I have made a concurrent client-server model in c++.
when i try to send a large file into packets to clinet side.
After receiving some packets to clinet side, connection is reset.
May be because of burst of packets at once at clinet side.

can any one help me to come out from this problem
plzzzzzzzzzzzzzzzzzzzzzzzzzzzz=AD=ADzzzz
zzzzzzzzzzzzzzz


thanks=20
girish

Barry Margolin

2005-05-18, 2:49 am

In article <1116392550.353864.168920@g44g2000cwa.googlegroups.com>,
girishdomain@gmail.com wrote:

> Connetion reset by peers (Socket Programming)
> in a Clinet Server Model ????


You already asked this question in the message "Connetion reset by peers
(Socket Programming) in a Clinet Server Model". You only have to ask
once.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
br0910

2005-05-18, 7:53 am

Is it a blocking or a non - blocking socket?

girishdomain@gmail.com

2005-05-19, 2:48 am

i have tried both options
but i am getting same unwanted result

br0910

2005-05-19, 5:52 pm

Read somewhere in the net that not closing the socket properly mite
cause this error. So, while closing, just try the following:

int bytesRecv = SOCKET_ERROR;
char tempbuff[32] = {0};

if(shutdown(Sock,SD_SEND))
printf("\nError in shutdown");

while( bytesRecv == SOCKET_ERROR )
{
bytesRecv = recv(Sock,tempbuff,sizeof(tempbuff),0);

if ( bytesRecv == 0 || bytesRecv == WSAECONNRESET )
break;
Sleep(SockTimeOut);//define SockTimeOut as sth say 1000
if (attempt== 0 ) // define attempt as sth say 5
{
printf("\ntimed -out");
break;
}
attempt --;

}
if(closesocket(Sock))
printf("\nError in close socket");

If the above doesn't work, then as a temporary work-around, try putting
in sleep stmt in the server before closing the socket, say Sleep(3000).

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com