sockets & UDP

sockets & UDP

Post by Spiros Ioanno » Sat, 22 Mar 2003 09:14:46



Hi all,
I have two  udp+sockets questions (mostly solaris oriented):
1)
If I understand correctly when an applications sends a UDP packet in a
host/port where noone is listening an ICMP "Port Unreachable" message will
be returned (or may be returned as I found in an RFC). If instead somebody
is listening, then the packed will be stored in a kernel buffer. My question
is how is it determined by the receiving OS if somebody is listening in some
port, does it have a timeout from the last recvfrom() call?
and if so how is this timeout altered.

2)
Reading the udp(7P) manual in solaris 2.7 it is stated that:
"A queue of received packets is provided  for each UDP socket. This  queue
has  a  limited
 capacity.  Arriving  datagrams which will not fit within its high-water
capacity are silently
discarded."

doing a ndd /dev/udp \? reveals  "the udp_recv_hiwat"  which sets the
"default maximum UDP socket receive buffer in bytes " according to Sun. In
my
machine it's 8192 bytes. There is also  udp_max_buf which " Controls how
large send and receive buffers (in bytes) can be for a UDP socket." which
defaults to
256K.

My question is: I want to receive a constant 4Mbps video stream from a video
server. Since
between recvfrom calls the 8K buffer should fill easily, it seems reasonable
to change this
buffer. Is it the standard procedure to raise the udp_recv_buf or am I
missing something?
Also, I cannot understand completely the difference between udp_recv_buf and
udp_max_buf.

Thank you for your time.
Spiros Ioannou

 
 
 

sockets & UDP

Post by Alexander Kotelniko » Tue, 25 Mar 2003 06:57:33


>>>>> On Fri, 21 Mar 2003 02:14:46 +0200


SI>
SI> I have two  udp+sockets questions (mostly solaris oriented):

You should better ask them in either comp.protocols.tcp-ip, or
comp.unix.solaris.

SI> 1)
SI> If I understand correctly when an applications sends a UDP packet in a
SI> host/port where noone is listening an ICMP "Port Unreachable" message will
SI> be returned (or may be returned as I found in an RFC). If instead somebody
SI> is listening, then the packed will be stored in a kernel buffer. My question
SI> is how is it determined by the receiving OS if somebody is listening in some
SI> port, does it have a timeout from the last recvfrom() call?
SI> and if so how is this timeout altered.

Almost sure, that TCP stack keeps track of bind() calls. If none of
sockets is bound to port Port Unreachable may be sent.

SI> 2)
SI> Reading the udp(7P) manual in solaris 2.7 it is stated that:
SI> "A queue of received packets is provided  for each UDP socket. This  queue
SI> has  a  limited
SI>  capacity.  Arriving  datagrams which will not fit within its high-water
SI> capacity are silently
SI> discarded."
SI>
SI> doing a ndd /dev/udp \? reveals  "the udp_recv_hiwat"  which sets the
SI> "default maximum UDP socket receive buffer in bytes " according to Sun. In
SI> my
SI> machine it's 8192 bytes. There is also  udp_max_buf which " Controls how
SI> large send and receive buffers (in bytes) can be for a UDP socket." which
SI> defaults to
SI> 256K.

udp_max_buf is the actual default buffer size. udp_recv_hiwat is a
size of a specific debug buffer (probably used with SO_DEBUG socket
option).

SI>
SI> My question is: I want to receive a constant 4Mbps video stream from a video
SI> server. Since
SI> between recvfrom calls the 8K buffer should fill easily, it seems reasonable
SI> to change this
SI> buffer. Is it the standard procedure to raise the udp_recv_buf or am I
SI> missing something?
SI> Also, I cannot understand completely the difference between udp_recv_buf and
SI> udp_max_buf.
SI>
SI> Thank you for your time.
SI> Spiros Ioannou
SI>
--
Alexander Kotelnikov
Saint-Petersburg, Russia

 
 
 

sockets & UDP

Post by Mario Vodopive » Wed, 26 Mar 2003 14:17:32


For 1) - ICMP "Port Unreachable" message may or may not be sent, both
hardware and software firewalls can be set to send this response, or just to
silently discard it (for security reasons). OS keeps tracks of open ports
(naturally), so the second part of the question doesn't make sense...
'recvfrom' blocks a process, not a kernel... Or maybe I misunderstood your
question? If you need to implement timeouts within your application, you may
choose to use 'alarm(unsigned int seconds)' and then to catch SIGALARM.

For 2) - This is definitely a case where you should have application level
buffers, you may increase kernel buffer a little bit, but kernel buffers are
not meant to buffer a minute of video or so, that would be a disaster. 8K is
probably enough, as input stream will be a way slower than copying from
memory to memory.


Quote:> Hi all,
> I have two  udp+sockets questions (mostly solaris oriented):
> 1)
> If I understand correctly when an applications sends a UDP packet in a
> host/port where noone is listening an ICMP "Port Unreachable" message will
> be returned (or may be returned as I found in an RFC). If instead somebody
> is listening, then the packed will be stored in a kernel buffer. My
question
> is how is it determined by the receiving OS if somebody is listening in
some
> port, does it have a timeout from the last recvfrom() call?
> and if so how is this timeout altered.

> 2)
> Reading the udp(7P) manual in solaris 2.7 it is stated that:
> "A queue of received packets is provided  for each UDP socket. This  queue
> has  a  limited
>  capacity.  Arriving  datagrams which will not fit within its high-water
> capacity are silently
> discarded."

> doing a ndd /dev/udp \? reveals  "the udp_recv_hiwat"  which sets the
> "default maximum UDP socket receive buffer in bytes " according to Sun. In
> my
> machine it's 8192 bytes. There is also  udp_max_buf which " Controls how
> large send and receive buffers (in bytes) can be for a UDP socket." which
> defaults to
> 256K.

> My question is: I want to receive a constant 4Mbps video stream from a
video
> server. Since
> between recvfrom calls the 8K buffer should fill easily, it seems
reasonable
> to change this
> buffer. Is it the standard procedure to raise the udp_recv_buf or am I
> missing something?
> Also, I cannot understand completely the difference between udp_recv_buf
and
> udp_max_buf.

> Thank you for your time.
> Spiros Ioannou

 
 
 

1. How to receive UDP and ICMP packet using one UDP socket, (Path MTUD)

Dear All,

Can we configure one socket to receive two different protocols packet.
Like how can we made a UDP socket to receive udp as well as icmp
messages.

Actually I am implementing Path MTUD, so for that I sent some udp
probs to destination host, now I want that the same socket at client
side must be able to receive both udp response and icmp error
messages(like host unreachable, port unreachable etc).

Another approach is that, we will use two sockets for both source and
destination, form source we will send udp probs(through udp socket)
while at destination host, after receiving that prob(through udp
socket), application will make an icmp packet and sent it back to the
source host (using ICMP socket). And here at source host, that message
and other icmp error messages will be received by icmp socket.

But this approch dosen't look efficient to me, what u people say? If
Any one has another approch plz let me know.

Eagerly waiting for some +ve pings.

2. Some quick SunLink questions

3. aplication to receive [ethernet|IP|UDP] and [ethernet|ppp|IP|UDP] packages over socket

4. ldt-fix-2.5.32-A3

5. application to receive ethernet|IP|UDP a ethernet|ppp|IP|UDP packages over socket

6. Music and Doom

7. broadcast & udp-socket

8. RealPLayer 8 on Solaris 10 woes

9. UDP sockets & select - is it possible

10. UDP server: single socket or multiple socket?

11. TCP socket to UDP socket?

12. iad2 & iad3 UDP and rawdevices icmp & tcp

13. ipfw-email & news clients & UDP