Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Socket Programming(UDP)

Socket Programming(UDP)

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++sysadminhardwarejson
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    A_Fa
    wrote on last edited by
    #1

    Hi all. I develop an application that send UDP packet to the embedded board. Embedded Board cannot receive packet because packet protocol changed to ARP. If I replace the Embedded Board with a PC and sniff network with WireShark, UDP packets are seen. what's the problem? If I send UDP packet with PacketBuilder to the Embedded board, it can receive it. I use MFC CSocket class to send UDP packet. My Code is:

    CSocket sockSrvr;
    if ( sockSrvr.Create(1239,SOCK\_DGRAM)==0)
    {
    	MessageBox("Can't create socket");
    	return FALSE;
    }
    char	data\[100\];
    memset(data,1,sizeof(data));
    if ( sockSrvr.SendTo(data,sizeof(data),1239,"10.14.83.11")<=0)
    {
    	MessageBox("Error in Sending");
    	return FALSE;
    }
    sockSrvr.Close();
    return TRUE;
    

    I test windows API to send UDP packet but not differ with CSocket. thanks for your help

    L 1 Reply Last reply
    0
    • A A_Fa

      Hi all. I develop an application that send UDP packet to the embedded board. Embedded Board cannot receive packet because packet protocol changed to ARP. If I replace the Embedded Board with a PC and sniff network with WireShark, UDP packets are seen. what's the problem? If I send UDP packet with PacketBuilder to the Embedded board, it can receive it. I use MFC CSocket class to send UDP packet. My Code is:

      CSocket sockSrvr;
      if ( sockSrvr.Create(1239,SOCK\_DGRAM)==0)
      {
      	MessageBox("Can't create socket");
      	return FALSE;
      }
      char	data\[100\];
      memset(data,1,sizeof(data));
      if ( sockSrvr.SendTo(data,sizeof(data),1239,"10.14.83.11")<=0)
      {
      	MessageBox("Error in Sending");
      	return FALSE;
      }
      sockSrvr.Close();
      return TRUE;
      

      I test windows API to send UDP packet but not differ with CSocket. thanks for your help

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      If the board will not accept UDP packets then there is not much you can do. You need to read the device's documentation to find out how it works.

      A 1 Reply Last reply
      0
      • L Lost User

        If the board will not accept UDP packets then there is not much you can do. You need to read the device's documentation to find out how it works.

        A Offline
        A Offline
        A_Fa
        wrote on last edited by
        #3

        Thank for your reply. Board can accept UDP packet. It can receive packet that generated with colasoft packet builder. Thanks again.

        L 1 Reply Last reply
        0
        • A A_Fa

          Thank for your reply. Board can accept UDP packet. It can receive packet that generated with colasoft packet builder. Thanks again.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Well that seems to be your answer.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups