Re: read hang on datagram socket



On Thu, 26 Jan 2006, Kurt Miller wrote:

> On Thursday 26 January 2006 7:26 pm, Daniel Eischen wrote:
> >
> > The modified version does not hang on 5.2. Do you have multiple
> > interfaces on your 5.4 box?
>
> No, the 5.4 box is virtually identical to the 6.0 box. I set them both
> up at the same time from initial installs for the project.
>
> truk@freebsd5-4$ ifconfig
> lnc0: flags=108843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> inet6 fe80::250:56ff:fe40:451a%lnc0 prefixlen 64 scopeid 0x1
> inet 172.16.1.36 netmask 0xffffff00 broadcast 172.16.1.255
> ether 00:50:56:40:45:1a
> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
> inet 127.0.0.1 netmask 0xff000000
> inet6 ::1 prefixlen 128
> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2

[ ... ]

> > What happens when you try using non-zero IP addresses and ports?
> >
>
> Setting the ports doesn't effect the problem, however setting the
> addresses does. It really seems like binding to INADDR_ANY only binds
> to loopback address 127.0.0.1 and not all the interfaces.
>
> If sock1 is bound to the hostAddress and sock2 connects to sock1 at
> the hostAddress it works ok. If sock1 is bound to INADDR_ANY and sock2
> connects to sock1 using INADDR_ANY it works. but any mixture of of
> using INADDR_ANY with the hostAddress fails.

According to Steven's Network Programming, when binding to
INADDR_ANY, the operating system doesn't assign an address
until the first write. This is unlike the port, where using
port 0, an ephemeral port is assigned right away. I don't
have the book handy right now, so I forgot if the INADDR_ANY
behavior is only when you have multiple interfaces or not.

> Unfortunately, I don't have control over the addresses, the java
> programs do. This particular jck test binds the first socket with
> INADDR_ANY (InetAddress.getByName("0.0.0.0")) and connects the second
> socket to the first using the hostAddress (InetAddress.getLocalHost()).

You can try sending a byte before getting the address for the
port and see if that works. Do you have anything weird, like
not having a default route (gateway)?

--
DE

_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: change ISA IP address
    ... You can have multiple IP's on the external interface for web-publishing ... can re-use the same listener for all your web publishing ... >> port 80, as WPAD in DNS does NOT allow specifying a custom port like WPAD ...
    (microsoft.public.isa)
  • Re: Generics vs Constants - what criteria do you use to choose between these?
    ... Since SystemVerilog has a similar capability with interfaces ... individual modes on each element of the record for use in a port ... Both cpu and periph attach to the same ...
    (comp.lang.vhdl)
  • Re: [PATCH RFC 0/11] usbserial: Serial Core port.
    ... it will be a lot of work to port all the USB-Serial drivers to the ... from the Serial Core implementation. ... Killing one of the interfaces would make people concetrate in only one ... for some reason the patchset e-mails didn't reach LKML. ...
    (Linux-Kernel)
  • Re: virtual com port driver
    ... to user space. ... your design goal (multiple COM ports) is not possible ... without a virtual bus device to enumerate the multiple ports or multiple ... "Ports" is the right class for a single port. ...
    (microsoft.public.development.device.drivers)
  • [SLE] 3 Ethernet Ports
    ... Can you help me with SuSE configuration? ... The system detects the 3 Ethernet interfaces in the installation. ... The system respond to 'ping command' in each RJ45 port assotiated with his ...
    (SuSE)