Mr Brett 
   
  Thanks. This is very helpful. I will try using the sockets as this will solve 
my problem and creating udp packets from scratch would be very cumbersome.
   
  Best Regards
   
  Muneeb

"Brett W. McCoy" <[EMAIL PROTECTED]> wrote:
          On 9/4/07, Muneeb Dawood <[EMAIL PROTECTED]> wrote:

Is there a reason you included messages from an entirely different thread?

> I want to write byte streams to udp packets. I would appreciate any help in 
> how to create udp packets in c. Thanks.

You didn't indicate your OS or anything... but if you are any POSIX
libraries (like on Linux, BSD, and Windows has ways of supporting
POSIX also), you can use the various send...() functions to send
messages to a server:

#include <sys/types.h>
#include <sys/socket.h>

ssize_t send(int s, const void *buf, size_t len, int flags);
ssize_t sendto(int s, const void *buf, size_t len, int flags, const
struct sockaddr *to, socklen_t tolen);
ssize_t sendmsg(int s, const struct msghdr *msg, int flags);

Of course, you need to setup your sockets and make sure you have
something to receive any messages on that socket.

If you want to create the UDP packets manually, I suggest you do some
research on how the packets are structured -- it's a fairly advanced
topic. Richrd Stevens second volume on Unix Network Programming covers
it pretty thoroughly, as will any book on TCP/IP networking.

-- Brett
----------------------------------------------------------
"In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world."
-- Jelaleddin Rumi


                         


Muneeb
       
---------------------------------
Building a website is a piece of cake. 
Yahoo! Small Business gives you all the tools to get online.

[Non-text portions of this message have been removed]

Reply via email to