Re: CSocket : testing (easy ... RE: AliR)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 02/10/05


Date: Wed, 09 Feb 2005 19:54:09 -0500

First, avoid CSocket entirely. This is always a mistake. Use CAsyncSocket exclusively.

While testing on your machine validates your protocol, it does not validate that your
protocol will work between two arbitrary machines.

First, you must not be using UDP. UDP is usually blocked at firewalls, and any router
between any two arbitrary machines is free to drop any UDP packet at any time for any
reason, and never, ever does it have to tell you that this happened. A UDP packet may be
truncated at any router to the minimum mandated by the Internet standards, and you will
never know; but since loopback doesn't involve a router it does not necessarily have to
truncate. UDP on loopback is utterly reliable; UDP across the Internet is asking for
trouble. Big time.

If you use TCP/IP, the number of problems that synchronous CSocket will get you into are
simply not worth dealing with.

Port numbers can be blocked at various routers for security reasons; for example, my
incoming router blocks ALL incoming TCP/IP and UDP port connections, allowing only
connections initiated by my machine to go outwards and get responses.

You should also make provision for the end user to reassign the port numbers used for
communication, since there is always the potential for conflict with a registered port
number for a service.

So any given point-to-point communication might fail due to routers and firewalls.
However, once you establish a TCP/IP connection, you know that you have a solid connection
and if anything goes wrong you will get a notification.

The reason for CAsyncSocket is that if the remote program hangs, your program hangs also,
and cannot be cleanly shut down. which is one of the major reasons for using CAsyncSocket.
                                joe

On Tue, 08 Feb 2005 21:20:36 GMT, "Juha-Pekka Kettunen"
<POISTA_AUTO_juhafiatkettunen@hotmail.com.invalid> wrote:

>ok, I got this chatter prog work.
>
>One question about debugging and testing: If I run these progs
>(client/server) *both on my own pc* to test them, Is it exactly the same
>thing than if I tested them with another pc though *internet*? So, does the
>messages go through the internet and come back to my computer? So if client
>and server works on my computer is it guaranteed to work with other
>computers as well though the internet?
>
>Juha
>
>
>
>>Here is an example from microsoft on how to write socket programs
>>
>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/_sample_mfc_CHATTER.asp
>
>>AliR.
>
>"Juha-Pekka Kettunen" <POISTA_AUTO_juhafiatkettunen@hotmail.com.invalid>
>wrote in message news:9RNNd.1711$K_6.457@newsfe1-win.ntli.net...
>> Hi
>>
>> I have never done this so I would like to ask that how do I communicate
>with
>> another pc on the Internet. For example if I want to send a message "Hello
>> World" from Finland to England though the Internet. I am using MFC. Is it
>> CAsyncSocket? Can you give me an example how to do it? thanks. I have not
>> done much internet programming, so I am a newbie ...
>>
>> The thing is that I want to make a multiplay game (server/client system)
>on
>> the internet and need to send some data ...
>>
>>
>
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: CAsyncsocket derived class being run as a thread
    ... Explain what you mean by CAsyncSocket being "run". ... You should live in a world in which it is EXPECTED that UDP packets will be dropped. ... database update, and the network thread would PostThreadMessage to the database thread, ...
    (microsoft.public.vc.mfc)
  • Re: VPN/RWW not able to establish connection
    ... I have been able to connect for the past several days, so I guess your "correct solution is one that works" is true. ... I did check Google and saw a reference that there was some handshaking going on that did use UDP port 50, but I can't find it now. ... If reconfiguration of your router requires a reboot then it's possible it was the reboot which fixed it and not the altered configuration. ... RWW requires TCP/IP ports 443 and 4125, PPTP VPN uses TCP/IP port 1723 and IP protocol 47. ...
    (microsoft.public.windows.server.sbs)
  • Re: blocking incoming udp packets
    ... It seems the router is sending udp packets to 255.255.255.255 (both ... UDP 162 is the SNMP trap port. ... The RIP disabling was easy to do, and that has stopped the traffic on ...
    (comp.security.firewalls)
  • Re: blocking incoming udp packets
    ... It seems the router is sending udp packets to 255.255.255.255 (both ... UDP 162 is the SNMP trap port. ... The RIP disabling was easy to do, and that has stopped the traffic on ...
    (comp.security.firewalls)
  • linux router using iptables: how to allow vpnc from lan
    ... CompR is the router computer running iptables and doing masquerading. ... able to connect to an external VPN serverusing a VPN ... udp dpt:500 ...
    (comp.os.linux.networking)