Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Sending packets

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Wed Dec 03, 2008 12:37 pm    Post subject: Sending packets Reply with quote

Anyone knows how to send packets to a server in c++?

I tried this code snipper i found somewhere, but it doesnt seem to work.
Code:

#include <cstdlib>
#include <iostream>
#include <windows.h>

char FakePlayer[] = {0x02, 0x00, 0xFC, 0x01, 0x07, 0x4B, 0x61, 0x64, 0x64, 0x61, 0x6B, 0x61, 0x00, 0x09, 0xC8, 0x96};
bool bPower = false;

   
sockaddr_in RecvAddr;
int main(int argc, char *argv[])
{
   int port = 36964;
   SOCKET sendSocket;
   WSADATA wsaData;   
   WSAStartup(MAKEWORD(2,2), &wsaData);
   RecvAddr.sin_family = AF_INET;
   RecvAddr.sin_port = htons(port);
   RecvAddr.sin_addr.s_addr = inet_addr("91.121.13.214");
   while(true)
   {
      if(bPower)
   sendto(sendSocket, FakePlayer, strlen(FakePlayer), NULL, (SOCKADDR*)&RecvAddr, sizeof(RecvAddr));
      if(GetAsyncKeyState(VK_F2) && !bPower)
         bPower = true;
      if(GetAsyncKeyState(VK_F2) && bPower)
         bPower = false;

      Sleep(5000);
   }
   return 0;
}



these are my compiling errors:
1>main.obj : error LNK2019: unresolved external symbol _sendto@24 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _inet_addr@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _htons@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function _main
Back to top
View user's profile Send private message
Zerith
Master Cheater
Reputation: 1

Joined: 07 Oct 2007
Posts: 468

PostPosted: Wed Dec 03, 2008 12:54 pm    Post subject: Reply with quote

Link it with WS2_32.lib.

I would suggest you do not copy codes, and learn the subject yourself.
Back to top
View user's profile Send private message MSN Messenger
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Wed Dec 03, 2008 5:06 pm    Post subject: Reply with quote

#include <winsock2.h>
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites