Valhalla Legends Archive

Programming => General Programming => Topic started by: ThePro on November 17, 2006, 04:54 PM

Title: UDP to TCP proxy?
Post by: ThePro on November 17, 2006, 04:54 PM
Hello!
I have Internetaccess in my University but I can't play Starcraft there, cuz the stupid admins blocked the UDP ports. I can join bnet but I get a Plug behind my name. :(

Now I got the Idea to code a Proxy tool, which sends the UDP packets of Bnet as TCP to my homecomputer which sends them as UDP to bnet.
I'd run that tool as Server on port 6112 on my Notebook and let Starcraft connect there.

Starcraft TCP > Proxy tool > Homecomputer > Bnet
Starcraft UDP > Proxy tool (Convert to TCP) > Homecomputer (Reconvert to UDP) > Bnet

Is that possible?
I know that TCP is much slower than UDP but the Traffic is about 1,5Kb/s so it should be no problem.
Title: Re: UDP to TCP proxy?
Post by: Skywing on November 17, 2006, 05:35 PM
It would probably be much simpler to just use a full VPN for this.

This forum is probably not the right location for such a discussion.
Title: Re: UDP to TCP proxy?
Post by: l2k-Shadow on November 17, 2006, 06:07 PM
Just keep in mind you'd have to make several TCP sockets to handle this and create a new connection for each IP that sends to the UDP port.
Title: Re: UDP to TCP proxy?
Post by: ThePro on November 17, 2006, 07:22 PM
Yes I know.
First I will analyse this UDP stuff.

If there is any interest I'd public the proxy tool here wehen it's done.
Title: Re: UDP to TCP proxy?
Post by: Ringo on November 19, 2006, 05:04 AM
Just use a socks server?
The 2nd byte into the login packet, is a protocol identification byte, 1 for a TCP connection, 2 for UDP Bind. (google will help here)
Iv persionaly never used a socks server for UDP, so im not exacly sure how you specify the address of the destination, when sending data.

What i would persinaly do, as long as your school enables UDP across the network, is write a socks server for your home PC, and a gateway for the school pc+starcraft.
That way, your gateway program can *network* all the udp data to your home pc's socks server, via a TCP connection.
Example, sending 8 bytes to the socks server infront of every udp message with the port/ip/message lengh, so that your socks server can buffer split TCP messages, as well as faward the message payload to the correct address/port.

Its easy in princible, hard in practiss :)
Title: Re: UDP to TCP proxy?
Post by: NetNX on November 28, 2006, 06:01 AM
Quote from: Ringo on November 19, 2006, 05:04 AM
Just use a socks server?
The 2nd byte into the login packet, is a protocol identification byte, 1 for a TCP connection, 2 for UDP Bind. (google will help here)
Iv persionaly never used a socks server for UDP, so im not exacly sure how you specify the address of the destination, when sending data.

What i would persinaly do, as long as your school enables UDP across the network, is write a socks server for your home PC, and a gateway for the school pc+starcraft.
That way, your gateway program can *network* all the udp data to your home pc's socks server, via a TCP connection.
Example, sending 8 bytes to the socks server infront of every udp message with the port/ip/message lengh, so that your socks server can buffer split TCP messages, as well as faward the message payload to the correct address/port.

Its easy in princible, hard in practiss :)

I belive that you can actually use a Socks5 server with SocksCap to do this. IRCC UDP is supported.
Title: Re: UDP to TCP proxy?
Post by: TheMinistered on January 03, 2007, 10:07 AM
Well, skywing, I have to disagree.  This is general programming and he is talking about writing a small program to provide a service.  I would consider this general programming, maybe you don't. 

At any rate, yes this should do the trick if you want to use your own tool for simplicity (bare minimum, no extra "cool" features, no bulkware/adware, etc).

Your idea sounds perfectly sound to me, why not get started?  Should only take you an hour or two to get it up and running.  The only concern I might have is with connection lag, but thats up to you to deal with.
Title: Re: UDP to TCP proxy?
Post by: Skywing on January 03, 2007, 01:21 PM
Quote from: TheMinistered on January 03, 2007, 10:07 AM
Well, skywing, I have to disagree.  This is general programming and he is talking about writing a small program to provide a service.  I would consider this general programming, maybe you don't. 
This thread originated in the wrong forum and was eventually moved to this forum.
Title: Re: UDP to TCP proxy?
Post by: Banana fanna fo fanna on January 03, 2007, 11:35 PM
ehhh i dunno about "an hour or two"
he's going to have to spoof the origin address of the udp packets being sent to the bnet client, which (probably) requires the use of raw sockets.
Title: Re: UDP to TCP proxy?
Post by: Joe[x86] on January 07, 2007, 09:34 PM
Quote from: l2k-Shadow on November 17, 2006, 06:07 PM
Just keep in mind you'd have to make several TCP sockets to handle this and create a new connection for each IP that sends to the UDP port.

Not necessarily. If the two TCP endpoints will both be in software he has written, he's in full control of it. It's entirely possible for him to include a header that states what IP the packet came from.

Quote from: Banana fanna fo fanna on January 03, 2007, 11:35 PM
ehhh i dunno about "an hour or two"
he's going to have to spoof the origin address of the udp packets being sent to the bnet client, which (probably) requires the use of raw sockets.

Not necessarily. He could go all out with this and tunnel the Battle.net <-> Client TCP channel through the proxy as well (even along the same socket, as described above!), making Battle.net think that the game is physically being played at his house.
Title: Re: UDP to TCP proxy?
Post by: A2 on February 12, 2007, 05:41 PM
Quote from: Ringo on November 19, 2006, 05:04 AM
Just use a socks server?
The 2nd byte into the login packet, is a protocol identification byte, 1 for a TCP connection, 2 for UDP Bind. (google will help here)
Iv persionaly never used a socks server for UDP, so im not exacly sure how you specify the address of the destination, when sending data.

What i would persinaly do, as long as your school enables UDP across the network, is write a socks server for your home PC, and a gateway for the school pc+starcraft.
That way, your gateway program can *network* all the udp data to your home pc's socks server, via a TCP connection.
Example, sending 8 bytes to the socks server infront of every udp message with the port/ip/message lengh, so that your socks server can buffer split TCP messages, as well as faward the message payload to the correct address/port.

Its easy in princible, hard in practiss :)

note: this functionality is absent in socks4 (never std'd afaik)