Jump to content
Sign in to follow this  

Game Proxy

Recommended Posts

i have a question about TCP functions and how i could go about doing this. The object is to make to connect to local host, on a port and the game and then do tcpsend to send the data being sent on the port through the proxy to the game. And also TCPRecv to recieve the data being sent to me. The problem is multiple connections arent aloud in autoit so i heard so my goal was to make use stdinwrite and stdoutread to talk to eachother on seperate programs but so far ive been kinda lost on such a thing any pointers on how possibly i could get this to work woudl be great

$LoginIP = ""
$ServerIP = ""
$CharIP = ""
$LoginPort = 23000
$ServerPort = 28000
$CharPort = 15400

$Socket = TCPListen("",$LoginPort,100)
Dim $ConnectedSocket = -1
    $ConnectedSocket = TCPAccept($MainSocket)
Until $ConnectedSocket <> -1
$run = Run("\send.exe",@DesktopDir,$STDIN_CHILD + $STDOUT_CHILD)
$recv = TCPRecv($ConnectedSocket,10000)

the send is the same except it connects to $LoginIP instead of local host

Share this post

Link to post
Share on other sites

Ofcourse multiple connections are allowed! You just can't put them on the same socket.

This has helped me personally greatly in trying to understand how TCP works.

Edit: What you are trying to do is possible, although I don't think it will be fast enough if you are going to proxy a game..

Edited by Manadar

Share this post

Link to post
Share on other sites

I know this thread is old but it is exactly what I'm trying to do, although I got mine to work with a minor problem. My proxy receives data from the game client and sends it to the game server, it then receives the data from the game server and relays it to the game client, however, it only does this for the initial connection. Once the game client has connected to the game server my proxy is no longer needed (I can close my proxy and the datastream between client and server continues, even after I close sockets as well). I know it works at first because my game will not connect to the game server without my proxy running. If anyone can tell me why this may be happening I'd greatly appreciate it. Id appreciate it even more if you download the game (its free, http://www.conqueronline.com/) and try my script to debug it lol

#include <GuiConstants.au3>

GuiCreate("Proxy", 177, 44,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))



$MainSocket = TCPListen("", 9958)

$ClientSocket = TCPAccept($MainSocket)

While $ClientSocket = -1

$ClientSocket = TCPAccept($MainSocket)


$ServerSocket = TCPConnect("", 9958)

While 1

$recv = TCPRecv($ClientSocket, 131072)

TCPSend($ServerSocket, $recv)

$recv = TCPRecv($ServerSocket, 131072)

TCPSend($ClientSocket, $recv)

$msg = GuiGetMsg()


Case $msg = $GUI_EVENT_CLOSE









Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...