ooops thanks for the info...but .. So, assuming the address from this packet is the address that you used to respond to with a pong, it would explain why your Bearshare servent didn't report receiving any data.
hey dude !
well u are absolutely right about the spy packet..thing...the payload and everything else match up...but the thing is that i am testing the servant that i am developing with bearshare running on the same pc...but running on a different port..i.e 6347...so i am not using the ip addresss recieved...from the spy packet..as suggested by you..(am i right ??).Here's some code from my server thread ..hope this makes things clear....
CBlockingSocket g_listener;
UINT serverthread(LPVOID param)
{
CSockAddr client_address;
CBlockingSocket client_sock_in;
CObList temp;
CMessage* poly;
byte* buffer=new byte[100];
int size=0;
int rec=0;
try{
if(!g_listener.Accept(client_sock_in,client_addres s))
{
TRACE("SOCKET CLOSED\n");
//socket closed for some reason..return
return(0);
}
AfxBeginThread(serverthread,param);
//TRACE("secondary thread started\n");
rec=client_sock_in.Receive((char*)buffer,(size=str len("GNUTELLA CONNECT/0.4\n\n")),10);
buffer[rec]='\0';
TRACE("the request is %s",buffer);
if(strnicmp((char*)buffer,"GNUTELLA CONNECT/0.4\n\n",size)==0)
{
client_sock_in.Write("GNUTELLA OK\n\n",14,10);
TRACE("\n\nWROTE HANDSHAKE");
poly=CMessage::read(&client_sock_in,buffer);
TRACE(" \n %s",poly->GetRuntimeClass()->m_lpszClassName);
temp.AddHead(poly);
CPong* p=new CPong(poly->getGUID(),0x07,6348,((byte*)"127.0.0.1"),7,890) ;
p->write(&client_sock_in);
TRACE("\nRITTEN");
CPing* pi=new CPing(0x07);
pi->write(&client_sock_in);
}
}
catch(CBlockingSocketException* e)
{
char* temp=new char[100];
e->GetErrorMessage(temp,100,NULL);
TRACE("the exception is %s",temp);
client_sock_in.Close();
delete e;
}
return(0);
}
As u can see i am using the socket returned in the accept call to write to bearshare client...which is running on the same pc on which i am developing the client.So there is no question about me mistaking the ip address to which i am sending the packet to...well i tried some sending packets to bearshare in an infinite loop...in the same thread as shown above...and the client does report recieving a bad packet of a huge length...so i am still confused. |