Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: How to format/send/receive UDP packet in C?

Reply
Thread Tools

Re: How to format/send/receive UDP packet in C?

 
 
Tom St Denis
Guest
Posts: n/a
 
      06-24-2003
bd wrote:
> On Mon, 23 Jun 2003 17:17:22 -0700, Abby wrote:
>
>
>>I'd like to ask about how to format/send/receive UDP datagram packet
>>in C language.

>
>
> You can't. You'll have to use some non-standard extensions. Since you
> didn't even tell us your OS, I can't give a pointer to a place where they
> can help.


I don't think you're reply was at all accurate. Most OSes support the
Berkeley socket API [e.g. socket(), bind(), connect(), ....]. Heck even
windows supports it.

That being said the OP really should invest in some google time. There
are tons of demos of TCP/UDP routines out there.

Tom

 
Reply With Quote
 
 
 
 
bd
Guest
Posts: n/a
 
      06-24-2003
On Tue, 24 Jun 2003 14:28:52 +0000, Tom St Denis wrote:

> bd wrote:
>> On Mon, 23 Jun 2003 17:17:22 -0700, Abby wrote:
>>
>>
>>>I'd like to ask about how to format/send/receive UDP datagram packet
>>>in C language.

>>
>>
>> You can't. You'll have to use some non-standard extensions. Since you
>> didn't even tell us your OS, I can't give a pointer to a place where they
>> can help.

>
> I don't think you're reply was at all accurate. Most OSes support the
> Berkeley socket API [e.g. socket(), bind(), connect(), ....]. Heck even
> windows supports it.


These are not topical for comp.lang.c.

--
Freenet distribution not available
Humor in the Court:
Q: Are you qualified to give a urine sample?
A: Yes, I have been since early childhood.

 
Reply With Quote
 
 
 
 
dbtid
Guest
Posts: n/a
 
      06-24-2003
On Tue, 24 Jun 2003 14:28:52 GMT, Tom St Denis <(E-Mail Removed)> wrote:

> bd wrote:
>> On Mon, 23 Jun 2003 17:17:22 -0700, Abby wrote:
>>
>>
>>> I'd like to ask about how to format/send/receive UDP datagram packet
>>> in C language.

>>
>>
>> You can't. You'll have to use some non-standard extensions. Since you
>> didn't even tell us your OS, I can't give a pointer to a place where
>> they
>> can help.

>
> I don't think you're reply was at all accurate. Most OSes support the
> Berkeley socket API [e.g. socket(), bind(), connect(), ....]. Heck even
> windows supports it.
>
> That being said the OP really should invest in some google time. There
> are tons of demos of TCP/UDP routines out there.
>
> Tom
>
>


His reply certainly was accurate from the C Standard.

Regulars to "comp.lang.c" know that things like UDP, TCP/IP, OS's,
etc, are not topical because they are outside of the Standard. His reply
was certainly accurate.

The OP was OT, albeit he didn't know it.

His comment that the C language does not support things like UDP is
accurate; those things are part of the operating system and the libraries
that come with them. They are NOT part of C.
 
Reply With Quote
 
Thomas Matthews
Guest
Posts: n/a
 
      06-24-2003
Tom St Denis wrote:
> dbtid wrote:
>
>> His reply certainly was accurate from the C Standard.
>>
>> Regulars to "comp.lang.c" know that things like UDP, TCP/IP, OS's,
>> etc, are not topical because they are outside of the Standard. His
>> reply was certainly accurate.
>>
>> The OP was OT, albeit he didn't know it.
>>
>> His comment that the C language does not support things like UDP is
>> accurate; those things are part of the operating system and the libraries
>> that come with them. They are NOT part of C.

>
>
> Ok, listen up. I know it was OT, heck I said that in my original reply.
>
> My comment was about the "oh which OS, how do I help? the agony!"
>
> Is complete stupid B.S. All OSes I've seen such as QNX, Linux, BSD,
> MacOS and Windows have fully functional Berkeley socket API
> implementations included by default in most cases or with a socket lib
> that is standard [wsock32.lib, libsocket.a, etc....]. Chances are the
> guys OS does have a socket implementation.
>
> If you're going to reply at least be correct and not randomly snipy.
>
> Tom
>


What about embedded operating systems like Nucleus Plus and Vertex?
Many embeded operating systems, especially the home grown ones, don't
have the room for UDP, TCP/IP stuff. This network support layer
is only valid for platforms that provide that functionality.

--
Thomas Matthews

C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html

 
Reply With Quote
 
Tom St Denis
Guest
Posts: n/a
 
      06-24-2003
Thomas Matthews wrote:
> Tom St Denis wrote:
>
>> dbtid wrote:
>>
>>> His reply certainly was accurate from the C Standard.
>>>
>>> Regulars to "comp.lang.c" know that things like UDP, TCP/IP, OS's,
>>> etc, are not topical because they are outside of the Standard. His
>>> reply was certainly accurate.
>>>
>>> The OP was OT, albeit he didn't know it.
>>>
>>> His comment that the C language does not support things like UDP is
>>> accurate; those things are part of the operating system and the
>>> libraries
>>> that come with them. They are NOT part of C.

>>
>>
>>
>> Ok, listen up. I know it was OT, heck I said that in my original reply.
>>
>> My comment was about the "oh which OS, how do I help? the agony!"
>>
>> Is complete stupid B.S. All OSes I've seen such as QNX, Linux, BSD,
>> MacOS and Windows have fully functional Berkeley socket API
>> implementations included by default in most cases or with a socket lib
>> that is standard [wsock32.lib, libsocket.a, etc....]. Chances are the
>> guys OS does have a socket implementation.
>>
>> If you're going to reply at least be correct and not randomly snipy.
>>
>> Tom
>>

>
> What about embedded operating systems like Nucleus Plus and Vertex?
> Many embeded operating systems, especially the home grown ones, don't
> have the room for UDP, TCP/IP stuff. This network support layer
> is only valid for platforms that provide that functionality.


Chances are if he was asking about UDP... guess what... just guess. Oh
common, put your damn college edumication to use....

HE HAS UDP SUPPORT IN HIS OS.

Chances are if he has UDP support... guess what... just guess. It is
probably based on Berkeley sockets API.

Oh my god are you people this anal. Not only did you guys not answer
his question [as to be expected from clc] but you were WRONG while
doing it.

Tom

 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      06-24-2003
Tom St Denis wrote:
>
> Thomas Matthews wrote:
> > Tom St Denis wrote:
> >
> >> dbtid wrote:

<snip>
> >>> His comment that the C language does not support things like UDP is
> >>> accurate; those things are part of the operating system and the
> >>> libraries
> >>> that come with them. They are NOT part of C.
> >>

<snip>
> >>
> >> If you're going to reply at least be correct


dbtid /is/ correct.

> >> and not randomly snipy.


Take your own medicine, please.

> >>

> > What about embedded operating systems like Nucleus Plus and Vertex?
> > Many embeded operating systems, especially the home grown ones, don't
> > have the room for UDP, TCP/IP stuff. This network support layer
> > is only valid for platforms that provide that functionality.

>
> Chances are if he was asking about UDP... guess what... just guess. Oh
> common, put your damn college edumication to use....
>
> HE HAS UDP SUPPORT IN HIS OS.


That is an unwarranted conclusion. Whilst he /probably/ has UDP support,
he might not. Someone might well ask about UDP despite their OS or
implementation not providing support for it. This is analogous to
someone asking how to do fork() in Visual C++, which is a question that
I've come across several times.

> Chances are if he has UDP support... guess what... just guess. It is
> probably based on Berkeley sockets API.
>
> Oh my god are you people this anal. Not only did you guys not answer
> his question [as to be expected from clc] but you were WRONG while
> doing it.


Actually, they were correct to object. Topical questions are generally
answered correctly in clc, and without the "randomly snipy" behaviour
which you berate when you perceive it (rightly or wrongly) in others but
in which you seem only too willing to indulge yourself. I see nothing
wrong with the answers to which you are objecting.

--
Richard Heathfield : http://www.velocityreviews.com/forums/(E-Mail Removed)
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton


 
Reply With Quote
 
dbtid
Guest
Posts: n/a
 
      06-24-2003
On Tue, 24 Jun 2003 14:45:54 GMT, Tom St Denis <(E-Mail Removed)> wrote:

> dbtid wrote:
>> His reply certainly was accurate from the C Standard.
>>
>> Regulars to "comp.lang.c" know that things like UDP, TCP/IP, OS's,
>> etc, are not topical because they are outside of the Standard. His
>> reply was certainly accurate.
>>
>> The OP was OT, albeit he didn't know it.
>>
>> His comment that the C language does not support things like UDP is
>> accurate; those things are part of the operating system and the
>> libraries
>> that come with them. They are NOT part of C.

>
> Ok, listen up. I know it was OT, heck I said that in my original reply.
>
> My comment was about the "oh which OS, how do I help? the agony!"
>
> Is complete stupid B.S. All OSes I've seen such as QNX, Linux, BSD,
> MacOS and Windows have fully functional Berkeley socket API
> implementations included by default in most cases or with a socket lib
> that is standard [wsock32.lib, libsocket.a, etc....]. Chances are the
> guys OS does have a socket implementation.
>


But they aren't part of C now, are they, which was the original thing
I was addressing, as well as the original responder.

> If you're going to reply at least be correct and not randomly snipy.
>


I was, and you're the one who's being snippy.

Calm down, and cut back on the caffeine.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      06-24-2003
Richard Heathfield wrote:
> Tom St Denis wrote:
> >

.... snip ...
> >
> > Oh my god are you people this anal. Not only did you guys not
> > answer his question [as to be expected from clc] but you were
> > WRONG while doing it.

>
> Actually, they were correct to object. Topical questions are
> generally answered correctly in clc, and without the "randomly
> snipy" behaviour which you berate when you perceive it (rightly
> or wrongly) in others but in which you seem only too willing to
> indulge yourself. I see nothing wrong with the answers to which
> you are objecting.


In fact answers to OT questions are automatically to be considered
suspect. Meanwhile our resident raging Ottawa Teenager shows no
signs of maturation nor of requiring removal from my PLONK file.
Note the dual interpretation of OT possible.


--
Chuck F ((E-Mail Removed)) ((E-Mail Removed))
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!


 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      06-25-2003
nobody wrote:
>
> dbtid sez:
> > But they aren't part of C now, are they, which was the original thing
> > I was addressing, as well as the original responder.

>
> The minute you said "which OS" you lost the right to make that claim,
> didn't you?


I can't find any reference in this thread to dbtid asking "which OS" the
OP is using.


> Anyway, maybe you didn't notice, this is crossposted to
> comp.protocols.tcp-ip, where St Denis's answer was very
> much on the mark.


That's fantastic, brilliant, and possibly even terrific, but it doesn't
make Mr St Denis's answer any less off the mark here in comp.lang.c.

<snip>

--
Richard Heathfield : (E-Mail Removed)
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton


 
Reply With Quote
 
Abby
Guest
Posts: n/a
 
      06-25-2003
Hi all,

Thanks for your replies. I'm using Windows XP to code. Anyway, I
downloaded the cygwin so that it has the same environment as in Linux.
I'm intend to use my code in both windows and linux.

The big question I have in mind right now is about how to receive
the packet. I've seen the client/server code, but I haven't seen the
code which send out packet to server, then receive the response back
from that server.
The code I got will send out packet, then the server receive packet
and do something .. (like showing that packet on the screen). I don't
need that ... 'cos after the server get the packet I sent, it will
send me back some data, and I need to find a way how to display that
data to my screen. If any of you have any clue, please let me know.
I'm just a beginner in network programming, so please forgive me if my
question seems to be stupid to you.

Thank to you all.

Abby.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
VoIP: UDP Packet compression to save bandwidth... groobo Cisco 5 10-17-2005 10:23 PM
Cisco CSS Load Balancing Radius UDP Packet digiusto Cisco 0 03-06-2005 09:41 AM
UDP/IP packet question Kott Cisco 4 07-13-2004 03:59 PM
udp (0) -> udp (0) traffic ? Tom Cisco 2 03-04-2004 06:06 PM



Advertisments