Sign in to follow this  
questors_endgame

socket:from self to somewhere to self

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

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