[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: working with UDP sockets



On Fri, Feb 20, 2004 at 11:13:25AM -0700, Balazs Nagy wrote:
> Hi guys,
> 
> If this isn't the right list for this question, please
> point me to a better place.
> 
> I compiled a piece of code on OpenBSD 3.3 and on 3.4,
> successfully.  The code attempts to connect to a UDP
> port on a remote host.  From the linux boxes it works
> just fine.  From the obsd boxes, I get the following
> ktrace snippet:
> 
>  23414 cvm-testclient CALL  sigprocmask(0x3,0)
>  23414 cvm-testclient RET   sigprocmask -65793/0xfffefeff
>  23414 cvm-testclient CALL  connect(0x3,0xcfbf8684,0x10)
>  23414 cvm-testclient RET   connect 0

Here you connect your udp socket to the remote side.

>  23414 cvm-testclient CALL  sigprocmask(0x1,0xffffffff)
>  23414 cvm-testclient RET   sigprocmask 0
>  23414 cvm-testclient CALL  mprotect(0x3c002000,0x1000,0x3)
>  23414 cvm-testclient RET   mprotect 0
>  23414 cvm-testclient CALL  mprotect(0x3c002000,0x1000,0x1)
>  23414 cvm-testclient RET   mprotect 0
>  23414 cvm-testclient CALL  sigprocmask(0x3,0)
>  23414 cvm-testclient RET   sigprocmask -65793/0xfffefeff
>  23414 cvm-testclient CALL  
> sendto(0x3,0x3c003440,0x15,0,0xcfbf8634,0x10)
>  23414 cvm-testclient RET   sendto -1 errno 56 Socket is already 
> connected

and then you use sendto... to connect again? That will not work as the
error trys to tell you.
Either use connect() and send() or just sendto() but not both together.

-- 
:wq Claudio