Is it possible to send peer to peer messages with sockets? If yes, how do I do it? What's my fault?

The magic of sockets is that it doesn't matter whether the other end is the same machine (loop-back address), a machine on the same LAN ("public" or "private" IP address) or a long way away ("public" IP address). So you are right to be puzzled...

What does matter is that (a) the client has a working address for the server, (b) the network in between is prepared to deliver packets between the two and (c) the server is prepared to accept connections from the client -- given the address the server is listening on, and the address the client is attempting to connect from.

I cannot tell whether you have an address problem here. You might be able to resolve that using good old-fashioned ping/traceroute. You can also poke at servers using telnet. In this day and age you should also consider whether some firewall is taking a dim view of the packets -- particularly at the server end. Also, the server itself may be "wrapped" against connections from outside the local network.


In reply to Re: Sending Socket peer to peer by gone2015
in thread Sending Socket peer to peer by karstenda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.