client & server (socket) running on same machine, tcpdump can't dumpout any packet info, how?

Discussion in 'Linux Networking' started by GS, Dec 7, 2005.

  1. GS

    GS Guest

    I am running client & server (socket based) on same machine, can I use
    "tcpdump" (tcpdump -i eth0 udp port xxx) to dump the packet?. I tried,
    I can't see any of packet based on the port number. How can I verify
    this. My server and client can't able to communicate, Is There any
    tools to verify client and server communications.
    GS, Dec 7, 2005
    1. Advertisements

  2. GS

    Toni Erdmann Guest


    with '-i eth0' you will not see the communication.
    The interface used is 'loopback' 'lo'.

    Depends on your OS (Unix? Linux, Solaris, ...)

    Try tcpdump without '-i xxx' option, at least without any option
    and then try to apply more and more filters.

    Toni Erdmann, Dec 7, 2005
    1. Advertisements

  3. GS

    GS Guest

    It is on Linux(RH), I tried without "-i eth0" option, still it prints
    "Listening on eth0", but I can't dump any packets "tcpdump udp port
    15000", here I am using port 15000, nothing dumps, how can I dump.
    GS, Dec 7, 2005
  4. GS

    Tauno Voipio Guest

    Please read the previous response again:

    If you're sending to *any* of the local IP addresses,
    the Linux TCP/IP stack is smart enough to route the
    packets via the loopback interface, lo. The packets
    get to the eth0 queue only when they are going outside
    or coming from outside. tcpdump (and friends, actually
    the libpcap library) captures the packets from the
    interface queue, and eth0 never sees the local packets.
    Tauno Voipio, Dec 7, 2005
  5. GS

    GS Guest

    Thanks, I got it with "lo",but I am using port 15000 on both sides, why
    I am seeing "32806" (below is my capture), when I dump I can see like
    this (I am using port 15000 on both sides). Here my hostname is
    (panther). this dump using tcpdump:

    server ----> client :
    panther.15000 > panther.32806......
    panther.32806 > panther.15000....

    client ---> server
    panther.32806 > panther.15000....
    panther.15000 > panther.32806......

    what is this 32806? when I am using port 15000 on both sides?. Thanks.
    GS, Dec 7, 2005
  6. When you say you are using port 15000 on both sides, what do you mean?
    If you mean that one side is sending *to* 15000 and the other is receiving
    *on* 15000, then what port is the first side receiving on and the other side
    sending to? (Hint, it's probably 32806)

    David Schwartz, Dec 8, 2005
  7. GS

    GS Guest

    I configured on both sides port as 15000, I pasted code below, this
    port 32806 is picked by system itself, Is that is not user
    configurable?. I mean system can pickup any port?. Here it picked 32806
    like that it can use any port right?. Is there anyway I can configure
    receiving on server port?. (can I replce 32806 with any other port
    number I like)?. Thanks.

    server code
    address.sin_family = AF_INET;
    address.sin_addr.s_addr = INADDR_ANY;
    address.sin_port = htons(15000);

    client code
    GS, Dec 8, 2005
  8. That doesn't really show much, but I'm assuming you configured the
    server side to listen on 15000 and the client side to send to 15000. That
    still leaves the client to decide what port to receive on, which will be the
    port the server will have to send to.
    Yes, you can 'bind' in the client. But it's usually a bad idea.

    David Schwartz, Dec 8, 2005
  9. GS

    GS Guest

    Here I have two clients, only one client can get the response the other
    one is not getting the response, Do I have to do any modification to my
    server incase if it wants to communicate two simultaneous clients?.
    Both are using same port number. Only one client (first started one)
    get the response always, the second clients never gets any response.

    ,/server (server)

    ../clien1 <ip-addr-of-serv> (first client)

    ../clie2 <ip-addr-of-sock> (second cli)

    GS, Dec 12, 2005
  10. GS

    Joseph2k Guest

    IIRC there is a second ID type number for IP connection right after the port
    number used to identify alternate clients from the same IP address. Don't
    remember how to use it though.
    Joseph2k, Jan 15, 2006
  11. That would be the port. Alternate clients from the same IP address
    connecting to the same destination port and destination IP address must use
    different source ports.

    David Schwartz, Jan 15, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.