Hello I am new to DaniWeb and this is my first Thread.

I am currently trying to develop a bot for the Game DarkOrbit. I used WPE Pro and I found out that I could controll the Spaceship by sending specific Packets (I have some Packet codes already).

Well heres the First Problem. I barely have experience with client Programming.

I found a book on Google which talks about TCP Client Programming and it also gives an Example but it doesnt work. It does try to connect but it never is successful.
Heres the link to the Book: http://books.google.com/books?id=JwKuQqW4b5EC&pg=PA696&lpg=PA696&dq=visual+c%2B%2B+socket+form+.net&source=bl&ots=seKI6Bbj_J&sig=85WnOjib64GFJHUNRh1j8ZnM4jE&hl=en&ei=EWzSSqq6H4OCmgOq_oiPAw&sa=X&oi=book_result&ct=result&resnum=6&ved=0CCEQ6AEwBQ#v=onepage&q=&f=false
(Go to Page 702)

Would this work to make a Bot Client? If yes what am I doing wrong in the Code below? How would I go on about sending specific packets eg "A0 3F..ect.." and are there other methods to do this?

Here is my Code (pretty much only Copy&Paste but I dont know even if this is the right way to connect to a game server.)

#include "stdafx.h"
#include <iostream>
using namespace System;
using namespace System::Net;
using namespace System::Diagnostics;
using namespace System::Net::Sockets;
using namespace System::Threading;
using namespace System::Text;

int main()

	Socket^ server = gcnew Socket(AddressFamily::InterNetwork,

		IPEndPoint^ iped = gcnew IPEndPoint(IPAddress::Parse(""),3963);  //Game Server
	catch (SocketException^ se)
		Console::WriteLine("Connection Failed with Server! Error 001", se->Message);

	array<unsigned char>^ msg = gcnew array<unsigned char>(1024);
	int rcv = server->Receive(msg);

	Console::WriteLine(Encoding::ASCII->GetString(msg, 0, rcv));

		Console::Write("Message ('q' to Quit): ");
		String^ input = Console::ReadLine();


		msg = Encoding::ASCII->GetBytes(input);
		server->Send(msg, msg->Length, SocketFlags::None);

		msg = gcnew array<unsigned char>(1024);
		rcv = server->Receive(msg);
		Console::WriteLine(Encoding::ASCII->GetString(msg, 0, rcv));

	Console::WriteLine("Ended Connection with server.");

    return 0;

Winsock2 seems to be easier and it suits my needs more than this.

This question has already been answered. Start a new discussion instead.