Valhalla Legends Forums Archive | General Programming | UDP to TCP proxy?

AuthorMessageTime
ThePro
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.
November 17, 2006, 10:54 PM
Skywing
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.
November 17, 2006, 11:35 PM
l2k-Shadow
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.
November 18, 2006, 12:07 AM
ThePro
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.
November 18, 2006, 1:22 AM
Ringo
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 :)
November 19, 2006, 11:04 AM
NetNX
[quote author=Ringo link=topic=16044.msg161392#msg161392 date=1163934290]
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 :)
[/quote]

I belive that you can actually use a Socks5 server with SocksCap to do this. IRCC UDP is supported.
November 28, 2006, 12:01 PM
TheMinistered
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.
January 3, 2007, 4:07 PM
Skywing
[quote author=TheMinistered link=topic=16044.msg162933#msg162933 date=1167840435]
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.  [/quote]
This thread originated in the wrong forum and was eventually moved to this forum.
January 3, 2007, 7:21 PM
St0rm.iD
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.
January 4, 2007, 5:35 AM
JoeTheOdd
[quote author=l2k-Shadow link=topic=16044.msg161316#msg161316 date=1163808441]
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.
[/quote]

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 author=Banana fanna fo fanna link=topic=16044.msg162942#msg162942 date=1167888948]
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.
[/quote]

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.
January 8, 2007, 3:34 AM
A2
[quote author=Ringo link=topic=16044.msg161392#msg161392 date=1163934290]
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 :)
[/quote]

note: this functionality is absent in socks4 (never std'd afaik)
February 12, 2007, 11:41 PM

Search