[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC socketpair
From: |
Bastien ROUCARIES |
Subject: |
Re: RFC socketpair |
Date: |
Fri, 8 Apr 2011 13:53:48 +0200 |
User-agent: |
KMail/1.13.5 (Linux/2.6.37-trunk-amd64; KDE/4.4.5; x86_64; ; ) |
Le jeudi 7 avril 2011 01:12:51, Bruno Haible a écrit :
> Hi Bastien,
>
> > A request for comment for a socketpair for windows.
> >
> > Please comment.
>
> I think it is too early for us to comment, because it appears that you have
> not
>
> yet started to compile and test the code:
> > int
> > socketpair (int domain, int type, int protocol, int sv[2])
> > {
> >
> > return raw_socketpair (int domain, int type, int protocol, int sv[2]);
> >
> > }
Sorry I have only compiled under linux and call raw_socketpair not socketpair
>
> I'm not aware of any compiler that would accept this syntax.
>
> To which platforms do you have access to? On which systems can you test
> code?
Linux only
> If you don't have access to Windows systems, then you could still write an
> implementation that works on Linux, FreeBSD, etc. and that uses only
> "simple" socket API functions - those that are present in <winsock2.h> and
> documented on msdn.microsoft.com -, in the hope to minimize the subsequent
> porting effort to Win32.
>
> Of course, if you want to do this, you also need a test program.
>
> In fact, the test program would be the first thing I would write, because I
> don't know how socketpair() is meant to behave and the implementations out
> there don't give me a clue either:
>
> - One implementation supports only d == AF_UNIX, type == SOCK_STREAM,
> protocol == 0, and uses the pipe() function.
>
> - Another implementation supports only d == AF_UNIX, type == SOCK_DGRAM,
> protocol == PF_UNIX, and calls in this order
> socket()
> bind()
> getsockname()
> socket()
> bind()
> getsockname()
> connect()
> connect()
>
> - Another implementation calls in this order
> socket()
> bind()
> listen()
> socket()
> connect()
> accept()
>
> - Another one calls
> socket()
> bind()
> getsockname()
> listen()
> socket()
> connect()
> accept()
>
> Once you have a test program - and it works with the native Linux and
> FreeBSD socketpair() system calls -, this test program will give
> confidence that the implementation based on simpler socket API calls is
> working.
This program work with AF_INET/AF_INET6 SOCK_STREAM/SOCK_DGRAM under linux. Do
not know how to test send receive.
Bastien
>
> Bruno