int main()
{
CRc5 dec;
WSADATA wsaData;
int err;
if((err =WSAStartup(0x0002, &wsaData)) !=0)
{
printf("Init WSAStartup() failed[%d].", err);
return false;
}
//socket structure
SOCKADDR_IN addr;//addr = socket structure
int addrlen = sizeof(addr);
//making the socket
SOCKET sListen;//listenig to the incoming connections
SOCKET sConnect;//operating the connection
//setuping the socket
sConnect=socket(AF_INET,SOCK_STREAM,NULL);//sock_stream = that the socket is a connection_oriented
//setup the structure
addr.sin_addr.s_addr=inet_addr("127.0.0.1");// ip of the connection
addr.sin_family= AF_INET;
//seting the prot
addr.sin_port= htons(9958);
//sertuping Listen socket
sListen=socket(AF_INET,SOCK_STREAM,NULL);
//binding connection
bind(sListen,(SOCKADDR*)&addr,sizeof(addr));
//listening
listen(sListen,SOMAXCONN);//listing with out any limit
printf("Attempting Socket Connection\n");
printf("Wating For An Incoming Connection!\n");
for(;;)
{
if((sConnect=accept(sListen,(SOCKADDR*)&addr,&addrlen)) != INVALID_SOCKET)
{
char buf[500];
int len = strlen(buf);
recv(sConnect,buf,len,0);
}
else
{
printf("Error accepting %d\n",WSAGetLastError());
}
}
}
but it's not receiving anything it's accepting the socket and then nothing happend why!!?
You've initialized a buffer of 500 bytes, but the string length is 0.
I have a kind of minor OCD complex with buffer sizes, and tend to always use multiples of 512
Nice to see abit more c++ here anyway.
i did wat u said but still it's not accepting to recv() <<< when it comes there it's like the program stop working but while am in infinity loop the program doesnot close , I appreciate ur help , please if there something else i missed or something i should add tell me thnx
Didn't even notice this but, it needs to be IPPROTO_TCP instead of null
Verified this for you on my side, and is working correctly.
i did that and still it's not working look it works for (5017-5100+) but like 5200+ it's not , look try to test it on a Client patch 5295 u will see what am talking about
i did that and still it's not working look it works for (5017-5100+) but like 5200+ it's not , look try to test it on a Client patch 5295 u will see what am talking about
Because on those later client's you send them the password seed, before they send you anything.
You can't mix C++/CLI code with native C++ code normally, and to do so you'd have to go through loads of code.
You can't use the current code to send a password seed packet either, you have to construct the packet and encrypt it with the auth crypto then send() it.
You can't mix C++/CLI code with native C++ code normally, and to do so you'd have to go through loads of code.
You can't use the current code to send a password seed packet either, you have to construct the packet and encrypt it with the auth crypto then send() it.
Or, since the auth crypto doesn't use a public key and it has just a 255 bytes which it uses to encode/decode buffers, you can simply calc it once, and just make a const buffer that needs to be sent.
MessagePacket 5290 02/11/2011 - CO2 Private Server - 1 Replies Problem Solved. Impulse FTW
Your structure is Wrong Basser.
5290 02/08/2011 - CO2 Private Server - 7 Replies Problem solved, Thanks everybody.
#request close
Fix 5290+ source NPC option!!!! 09/18/2010 - CO2 PServer Guides & Releases - 1 Replies First thx pro4ever rel this source !!!!
I set up , and test it ...
Test the npc option is not work...
now i will teach you how to fix that
Open SocketClient.cs
Add code:
where can i download 5290 c# Source 09/02/2010 - CO2 Private Server - 19 Replies hello
I saw some people talking about the new 5290 C# Source.
if any one have it or know from where can i download Source.
Tell ME Please
(If it is full or not, there are my friends will be working In IT )
They Learned C# Language
Sorry For My Bad English:p