On RZ/T1 Ethernet setup, cre_soc fails with E_PAR for second socket

I am trying to add another socket connection for the same port for Ethernet / TCP/IP.  

Existing code does this ( and succeeds )

HostEndPoint.port = TCPSocketPort;
HostEndPoint.num = 1; /* device number */
HostEndPoint.ver = IP_VER4;
HostEndPoint.ipa = INADDR_ANY;

ReturnValue = cre_soc ( IP_PROTO_TCP, &HostEndPoint );

But adding the following, fails:

HostEndPoint2.port = TCPSocketPort;
HostEndPoint2.num = 2; /* device number */
HostEndPoint2.ver = IP_VER4;
HostEndPoint2.ipa = INADDR_ANY;

ReturnValue2 = cre_soc ( IP_PROTO_TCP, &HostEndPoint2 );

ReturnValue2 is E_PAR, which indicates "Host" problem according to docs.  

Looking for some guidance on how to track this down.  



  • Hi,

    An E_PAR error in this case probably means that the specified address is in use.

    To create multiple passive connections on the same TCP port:

    • Call cre_soc to prepare the socket, then call con_soc to wait for a connection (SOC_SER).
    • Do this for as many passive connections as you want.

    Upon receiving a connection request from a peer, a connection is established on one of the listening sockets.


  • Thank you for your support.  

    I've gotten past this initial issue and have another question I'm hoping you can help me with.  

    I'll describe my system a little to help you understand the issue.

    We use 2 sockets (command and data ) for a connection. A single  Client connects to each.  We have only one socket of each type allocated. 

    Problem we have is that if the client doesn't disconnect, the passive connect keeps those sockets tied up, and subsequent connections cannot happen.  

    My approach is to create a "ping-pong" configuration.  2 sockets of each type (cmd[2] data[2])  where, when the 2nd connection occurs (which currently is rejected) that connection will abort the other socket (i.e. - connection on cmd[2] will reset the cmd[1] if it was previously active )  

    So to summarize my current issue, When I attempt to reset the socket using abt_soc and cls_soc, the abt_soc succeeds, but the cls_soc returns -18 ( E_OBJ ) error and that socket cannot be connected to afterwards.

    Is there a proper way, from the server, to shutdown / restart a passive socket?  

    Thanks again.


  • Hi,

    I don't understand your "ping-pong" configuration approach very well, since your explanation lacks information about the port numbers used and detailed processing flow.
    The FTP protocol is a typical protocol that uses two connections: command (control) and data.
    I recommend you refer to it.

    See the "TCP sequence" diagram in the manual.

    To close a socket that has an established connection, use con_soc (+con_soc) +cls_soc, regardless of server/client role. (then delete the socket using del_soc if necessary)
    To release the waiting state of passive connection using con_soc, call abt_soc (and confirm that an E_RLWAI error is returned if necessary), then wait for a connection using con_soc again. (or delete the socket using del_soc if necessary)


  • Thank you.  I will check out the FTP protocol for an example.

    Appreciate your help!

Reply Children
No Data