socket:from self to somewhere to self

Started by
5 comments, last by Ozymandias42 17 years, 7 months ago
Im doing some c++ socket programming, UDP, and it's going well, a little too well. The reason is I am running a client and server, on the same computer, and they arn't connecting through the isp. Nothing I try seems to change that. I would like to connect to myself in a way that simulates a remote user connecting. I want it to lag and have missing packets. I tried to find a proxy service that would do that but they only seem to be for http and other such things. Any suggestions on how to test 'online' programs like this?
___ _ _ _Journal with textures, moddeling:http://btoxin.livejournal.comGame Website:http://fadedearth.infinityanalog.com
Advertisement
Are you using the loopback IP address for testing your sockets (127.0.0.1)? This should keep stuff away from your ISP's routers etc.
No. I tested with a game program (Soldat) too. I ran the server, , found my IP address,connected to the server with the real ip, and it was still not sending anything to/through the isp. I've been looking for a solution to this for a while so anything you can tell me would be helpfull. I do not want to develop a server or whatever by uploading it somewhere constantly.
___ _ _ _Journal with textures, moddeling:http://btoxin.livejournal.comGame Website:http://fadedearth.infinityanalog.com
Hmm, this is difficult, because your OS notices that you're trying to send packets to yourself and helps you out by not sending them round the Internet first. Your best bet may be to find a mate with a boradband connection and ask him to host a trivial UDP proxy for your app.
well you could write a program that listens on one port, say port X and sends all messages it gets from the port of the game client to the server port and everything that comes from the server port to the client port.
and if you want this thing to simulate lag or packetloss simply discard some of these forwarded packets or sleep() during the recv-send loop

of course the client has to be reconfigured to send his packets to your program (port X) and that program has to know the server port, but in a simple program like that you can either hardcode these values or have a config file for reuse with other games,...

client(port A) connects to port X (the "proxy"-program, thinking of it as the server)
the "proxy"-program(port X) connects to port Y (the server)
server sends everything to port X (thinks this is the client)
the "proxy"-program gets all data from server and sends or not with or w/o to the client
well maybe if I knew everything about network programming I could simulate lag and network problems. I'm not going to try though. Thanks for the replies. If my OS, WINXP, " helps you out ", as Bob Janova put it, can I make it not help me out?
___ _ _ _Journal with textures, moddeling:http://btoxin.livejournal.comGame Website:http://fadedearth.infinityanalog.com
You may be behind a router. Your computer will think it's a foreign address and send it out, but your router will notice something is fishy and quash it. Try sending it loopback. If you want to simulate lag, there are a couple of good ways. The easiest would be to write a small program that read in packets, waited a set or random amount of time, and then sent them on to their destination. You'd just have to configure it as to where the server and client were.

This topic is closed to new replies.

Advertisement