Thread: Simulating Internet Conditions On My PC

  1. #1
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273

    Question Simulating Internet Conditions On My PC

    Hello,

    I've written a client and a server application that uses Winsock to communicate. While testing them, I had the client on my computer connecting to the server which was also running on my computer (effectively a loopback). Both applications worked fine with normal testing.

    Then I passed my client onto a friend, who would test it by connecting to my server over the Internet (we have different ISPs). However, during testing I found that the server froze every time.

    Now I know my TCP stream-handling code isn't that good, but I'd like to be able to test it without wasting my friend's time. Is there some kind of proxy server I can run which I can feed packets into as normal and will then gradually transfer the lot to the other application's socket, fragmenting packets and reducing throughput to simulate the high seas of the Internet, all on my PC?

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I don't know if there are any existing programs or hacks that simulate TCP packet fragmentation. But you could probably do it yourself by creating a "middleman" program to sit between your server and client, mixing up the packets it receives and sending them on after a slight delay.

    Alternatively, you could host your server online and test the client yourself, getting real internet conditions, and without wasting anyone's time. (But you might waste your bandwidth; might want to make sure you have unlimited amounts.)

    You could also try posting your code on this board -- I'm sure someone would spot something that could use improvement.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    When you opening socket - you can specify the buffer size
    try to specify the reciving buffer size on server smaller than the avarage packet size you sent
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 10-27-2006, 01:21 PM
  2. Need help with reformating my pc
    By XunTric in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 11-22-2005, 04:44 PM
  3. Internet Problems
    By SirCrono6 in forum Tech Board
    Replies: 3
    Last Post: 04-26-2004, 09:47 PM
  4. Post you pc pics (mods)
    By biosninja in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 03-15-2004, 04:15 PM