problem with the udp socket

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi All,

I am facing an issue with the UDP sockets in PPC 2003.
The sockets are created and I am able to bind also both the client and the
server apps to the port and the ethereal shows that data is being transferred
from the client to the server app but after the client sendto() is executed
it generates an ICMP packet which says Destination/Port unreachable and the
recvfrom() on the server end hangs.

I am running the server and the client on two systems connected through the
cross cable. I am posting the code for both the server and the client.
Also the same code runs perfectly fine on the same setup for the desktop. It
does not generate any such ICMP packets for Port unreachable and recvfrom()
also successfully executes. Please help!


//===========Client.cpp===========

char *server_name= "10.112.41.5";
struct sockaddr_in si_other, self;
int s, i, slen=sizeof(si_other);
char buf[256];
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
return FALSE;
}
if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
{
MessageBox(NULL,L"Error Opening socket" , NULL , 0);
}

memset((char *) &si_other, sizeof(si_other), 0);
si_other.sin_family = AF_INET;
si_other.sin_port = htons(10000);
si_other.sin_addr.s_addr = inet_addr(server_name);

int test2 = 1;
int yy = setsockopt(s, SOL_SOCKET , SO_KEEPALIVE , (char *) &test2 ,
(int)sizeof(test2));

if (bind(s, (struct sockaddr *)&self, sizeof(self)) == -1)
{ MessageBox(NULL,L"error binding\n" , NULL , 0);

}

memset(buf,0,256);
strcpy(buf, "Data sent to the server");
while (1)
{
if (sendto(s, buf, strlen(buf), 0, (struct sockaddr *)&si_other, slen)==-1)
{
MessageBox(NULL,L"sendto failed\n" , NULL , 0);
}
closesocket(s);
return TRUE;
//======================

//=========Server.cpp ==============


struct sockaddr_in si_me, si_other;
int s, i, slen =sizeof(si_other);
char buf[256];

WORD wVersionRequested;
WSADATA wsaData;
int err;

wVersionRequested = MAKEWORD( 2, 2 );

err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
return FALSE;
}

if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
{
MessageBox(NULL,L"Error Opening socket" , NULL , 0);
}

memset((char *) &si_other, sizeof(si_other), 0);
si_other.sin_family = AF_INET;
si_other.sin_port = htons(1080);
si_other.sin_addr.s_addr =INADDR_ANY;
memset(buf,0,256);

int errRecvFrom ;

int test2 = 1;
int yy= setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *) &test2,
(int)sizeof(test2));
int errSetSockOpt = WSAGetLastError();
if (bind(s, (struct sockaddr *)&si_other, sizeof(si_other))==-1)
{
MessageBox(NULL,L"Error binding socket" , NULL , 0);
}

while(1){
if (recvfrom(s, (char *)buf, 23, 0 , (struct sockaddr *)&si_other, &slen)==-1)
{
MessageBox(NULL,L"recvfrom error " , NULL , 0);

}
else
MessageBox(NULL,L"recvfrom success" , NULL , 0);

}
closesocket(s);

return TRUE;

}

.



Relevant Pages

  • RE: SSPI Kerberos for delegation
    ... you have to check on 'trust this machine for delegation' in the server computer's ADUC property page. ... Doing this will tell the client kerberos package that it should get a forwardable ticket and that it should forward it ... int n = ib.cbBuffer; ... // wserr() displays winsock errors and aborts. ...
    (comp.protocols.kerberos)
  • [NT] Dark Age of Camelot Man-In-The-Middle
    ... use of RSA public key cryptography and an RC4 based symmetric algorithm. ... Seeing the imminent release of code for cracking the game client (which ... At the beginning of each TCP session, the server sends a 1536 bit RSA ... void bytes_out(unsigned char *data, int len) ...
    (Securiteam)
  • echo client using threads
    ... pollwhile client is written using threads. ... server recvs some characters from a client and then echoes the ... int main ... exit(EXIT_FAILURE); ...
    (comp.unix.programmer)
  • Re: Problem with SslStream when using Windows Vista
    ... The code for the server & client follow. ... private int _port = 0; ... // SslStream using the client's network stream. ...
    (microsoft.public.dotnet.framework)
  • [UNIX] Multiple up-imapproxy DoS Vulnerabilities
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... connections open after client has logged out, ... allows attacker to cause the server to crash by sending them when they ... extern void HandleRequest(int); ...
    (Securiteam)