Hello Albert,

Thursday, October 19, 2000, 7:58:41 PM, you wrote:

AS> I am testing my modified cli.cpp and ser.cpp

AS> but I want to establish the connection from one workstation to another,
AS> I mean, not the same:



AS> server
AS>  /* Prepare TCP socket for receiving connections */

AS>   listen_sd = socket (AF_INET, SOCK_STREAM, 0);   CHK_ERR(listen_sd,
AS> "socket");

AS>   memset (&sa_serv, '\0', sizeof(sa_serv));
AS>   sa_serv.sin_family      = AF_INET;
AS>   sa_serv.sin_addr.s_addr = INADDR_ANY;
AS>   sa_serv.sin_port        = htons (1111);          /* Server Port number
AS> */

AS>   err = bind(listen_sd, (struct sockaddr*) &sa_serv,sizeof (sa_serv));
AS>   CHK_ERR(err, "bind");

AS>   /* Receive a TCP connection. */


AS> client

AS> /* Create a socket and connect to server using normal socket calls. */

AS>   sd = socket (AF_INET, SOCK_STREAM, 0);       CHK_ERR(sd, "socket");

AS>   memset (&sa, '\0', sizeof(sa));
AS>   sa.sin_family      = AF_INET;
AS>   sa.sin_addr.s_addr = inet_addr ("127.0.0.1");   /* Server IP */
AS>   sa.sin_port        = htons     (1111);          /* Server Port number
AS> */

AS>   err = connect(sd, (struct sockaddr*) &sa,sizeof(sa));
AS>   CHK_ERR(err, "connect");



AS> INADDR_ANY what does it mean? I think it is for this reason that does
AS> not connect, I think that I would have to put the same as client or not?

AS> thank you in advance

INADDR_ANY of course means 'any incoming address' - anyone on the net
will be able to connect to your server. But why the server IP in your
source code is 127.0.0.1? It's YOUR LOCAL IP, not the server's! You
should change it to server's real IP.

-- 
Best regards,
 Lenya                            mailto:[EMAIL PROTECTED]


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to