Hi all,

I should implement a TCP/IP sockets connection between two Pilots or
from a Pilot to a Windows host for a university-project. Didn't have any

problems using the pilot as client. In this case I use NetUTCPOpen - and

everything is fine.
But to establish a connection between two pilots - over the internet for

example - I should have one acting as a server with the sequence :
socket(), bind(), listen(), accept().

But accept always fails with:       netErrParamErr    -  errno = 0x1204

I tried allmost everything but can't find the problem. And I couldn't
find any Examples on the net where the pilot acts as a TCP/IP server.
Somehow a strange configuration, I know?

My enviroment is: Copilot2.1d29 on Win98,   the client should be a
java-application on the same machine.

Can anybody please give me a hint?

Here's the code snippet where the error occurs:

--------------------8<-------------------
static void ActAsServer( int par_port){
  char buf[5];
  NetSocketAddrINType remSockAddr;
  int oldSock, remAddrLen = sizeof( remSockAddr);

//--- at this point  the Netlib is already opened and the timeout
initialiced to 10 sec.

  memset((char *) &SockAddr, 0, sizeof(SockAddr));
  SockAddr.family = netSocketAddrINET;
  SockAddr.port = htonl( par_port);
//  SockAddr.addr = ignored in bind????

  // this should be for the dogs but I tried anyway
  memset((char *) &remSockAddr, 0, sizeof(remSockAddr));
  remSockAddr.family = netSocketAddrINET;
  remSockAddr.port = SockAddr.port;
 // remSockAddr.addr =  // not known before connection

//  SocketRef = socket(AF_INET, SOCK_STREAM, 0);
  SocketRef = socket( netSocketAddrINET,
        netSocketTypeStream,
        htons( 6 ) // currently ignored
        );
  if( SocketRef == -1) {   CustomNWErr( "opening socket", errno);
return; }

//  if( bind(SocketRef, (struct sockaddr *) &SockAddr, sizeof(SockAddr))

< 0)
  if( bind( SocketRef,
     &SockAddr,  sizeof( SockAddr)))
    { Disconnect(); CustomNWErr( "binding socket", errno);  return;}

  if( listen( SocketRef, 1)) // queueLen truncated to 1 anyway
    { Disconnect(); CustomNWErr( "set socket listen", errno); return;}

  AppNetTimeout = SysTicksPerSecond()*20;
  oldSock = SocketRef;
  if( (SocketRef = accept( SocketRef,
       &remSockAddr,
       &remAddrLen))==-1)
    { CustomNWErr( "accepting socket", errno);  Disconnect(); close(
oldSock); return;
// HERE I GET MY ERROR:  netErrParamErr    = 0x1204
    }
...
}
--------------------8<-------------------

Thanks in advice
    Markus



--
------------------------------------------------------
Markus Arzl            phone:  +43 5678 5459
Oberbach 32            mobile: +43 664 2746497
A-6671 Wei�enbach      email:  [EMAIL PROTECTED]
------------------------------------------------------


Reply via email to