Thread: Socket Datagram info sendto(), recvfrom()

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    1

    Socket Datagram info sendto(), recvfrom()

    Hi, i'm new , and i like so much this forum!
    i've a question about socket datagram, can i send a struct directli with the function sendto (..) ? or I have only the possibility to send vector of char ??
    i need to send a frame with Data , Cecksum, and number of packet, using Datagram UDP . . .

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    You can send any contiguous block of memory you like (up to around 1500 bytes).

    But watch out for endian and alignment issues - different machines will interpret the data differently unless you're careful.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Raw socket
    By like_no_other in forum Networking/Device Communication
    Replies: 4
    Last Post: 03-28-2009, 02:05 PM
  2. Raw socket and sendto()
    By matB in forum Networking/Device Communication
    Replies: 4
    Last Post: 07-10-2008, 05:07 PM
  3. sendto Socket packet size
    By bj00 in forum Networking/Device Communication
    Replies: 0
    Last Post: 07-27-2007, 11:05 AM
  4. Datagram Unix socket problem
    By karas in forum C Programming
    Replies: 9
    Last Post: 07-27-2006, 10:08 AM
  5. Help doing an e-mail program in c...
    By Tyler_Durden in forum C Programming
    Replies: 88
    Last Post: 01-02-2005, 03:12 PM