none
Udp Socket ? RRS feed

  • Question

  • Hi

    I opened an udp socket (socket(AF_INET, 2, 0))

    when I send msg via this socket, and sniff the packet via WIRSHARK i see:

    158 178.735618 192.168.1.102 10.0.2.15 IP Bogus IP header length (4, must be at least 20)

     

    1. Why wireshark  identify this packet as IP and not as UDP ?

    2. Is there any chance, that this socket is raw socket ?

    • Moved by lucy-liu Wednesday, February 9, 2011 8:08 AM it is not related to vc (From:Visual C++ General)
    Monday, February 7, 2011 5:17 PM

Answers

  • the port I used was 9000 (save for know protocol)

    change it to 9003 and now it works

    • Marked as answer by amit1983 Wednesday, February 9, 2011 6:18 PM
    Wednesday, February 9, 2011 6:18 PM

All replies

  • UDP like TCP is a different layer protocol than IP.

    So whether you're using TCP or UDP the underlying layer is always IP, meaning there is always an IP address in both cases.

    That's the reason it is called either TCP/IP or UDP/IP.


    «_Superman_»
    Microsoft MVP (Visual C++)
    Monday, February 7, 2011 7:31 PM
  • so,

    1. why I can sometimes see TCP or UDP in the protocol ?

    2. why it is written that the IP is Bogus IP ?

    Monday, February 7, 2011 7:41 PM
  • On 2/7/2011 12:17 PM, amit1983 wrote:

    I opened an udp socket (socket(AF_INET, 2, 0))

    when I send msg via this socket, and sniff the packet via WIRSHARK i see:

    158 178.735618192.168.1.102 10.0.2.15IP Bogus IP header length (4, must be at least 20)

    Try calling bind() before sending, so that your socket is assigned a local address/port.


    Igor Tandetnik

    Monday, February 7, 2011 7:47 PM
  • I tried and same get the same result...
    Monday, February 7, 2011 7:54 PM
  • Check the return value of bind(). What is it?
    Monday, February 7, 2011 7:57 PM
  • return value = 0
    Monday, February 7, 2011 8:46 PM
  • Hi amit1983,

    I am moving this thread from “Visual C++ General" forum to the “Winsock Kernel(WSK)” forum.,
    since the issue is related to Winsock Kernel(WSK).There are more experts in the “Winsock Kernel(WSK)" forum.

     

    Best regards,

    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 9, 2011 8:08 AM
  • the port I used was 9000 (save for know protocol)

    change it to 9003 and now it works

    • Marked as answer by amit1983 Wednesday, February 9, 2011 6:18 PM
    Wednesday, February 9, 2011 6:18 PM