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

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

server
 /* Prepare TCP socket for receiving connections */

  listen_sd = socket (AF_INET, SOCK_STREAM, 0);   CHK_ERR(listen_sd, "socket");
 
  memset (&sa_serv, '\0', sizeof(sa_serv));
  sa_serv.sin_family      = AF_INET;
  sa_serv.sin_addr.s_addr = INADDR_ANY;
  sa_serv.sin_port        = htons (1111);          /* Server Port number */
 
  err = bind(listen_sd, (struct sockaddr*) &sa_serv,sizeof (sa_serv));
  CHK_ERR(err, "bind");
 
  /* Receive a TCP connection. */
 
 
client

/* Create a socket and connect to server using normal socket calls. */
 
  sd = socket (AF_INET, SOCK_STREAM, 0);       CHK_ERR(sd, "socket");
 
  memset (&sa, '\0', sizeof(sa));
  sa.sin_family      = AF_INET;
  sa.sin_addr.s_addr = inet_addr ("127.0.0.1");   /* Server IP */
  sa.sin_port        = htons     (1111);          /* Server Port number */
 
  err = connect(sd, (struct sockaddr*) &sa,sizeof(sa));
  CHK_ERR(err, "connect");
 
 

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

thank you in advance
 

-- 
Albert SERRA 
===========================================
Integrated Systems Laboratory (DE/LSI-EPFL)
email: [EMAIL PROTECTED]
 
begin:vcard 
n:Serra Pages;Albert
tel;home:0786407287  -  +41786407287
tel;work:0216936975  -  +41216936975 
x-mozilla-html:FALSE
version:2.1
email;internet:[EMAIL PROTECTED]
adr;quoted-printable:;;Residence Marcolet =0D=0APre-Fontaine 12 Ch. 23;1023 Crissier;;;Switzerland
x-mozilla-cpt:;-21728
fn:Albert Serra Pages
end:vcard


Reply via email to