apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apr/test client.c server.c
Date Tue, 21 Nov 2000 19:15:32 GMT
trawick     00/11/21 11:15:30

  Modified:    test     client.c server.c
  Log:
  updates to changed interfaces to apr_set_port(), apr_get_port(),
  apr_set_ipaddr(), and apr_get_ipaddr()
  
  Revision  Changes    Path
  1.21      +10 -8     apr/test/client.c
  
  Index: client.c
  ===================================================================
  RCS file: /home/cvs/apr/test/client.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- client.c	2000/11/19 01:54:12	1.20
  +++ client.c	2000/11/21 19:15:27	1.21
  @@ -73,7 +73,7 @@
       char *dest = "127.0.0.1";
       apr_port_t local_port, remote_port;
       apr_interval_time_t read_timeout = -1;
  -    apr_sockaddr_t *destsa;
  +    apr_sockaddr_t *local_sa, *remote_sa;
   
       setbuf(stdout, NULL);
       if (argc > 1) {
  @@ -100,7 +100,7 @@
       fprintf(stdout, "OK\n");
   
       fprintf(stdout,"\tClient:  Making socket address...............");
  -    if ((stat = apr_getaddrinfo(&destsa, dest, APR_UNSPEC, 8021, 0, context)) 
  +    if ((stat = apr_getaddrinfo(&remote_sa, dest, APR_UNSPEC, 8021, 0, context)) 
           != APR_SUCCESS) {
           fprintf(stdout, "Failed!\n");
           fprintf(stdout, "Address resolution failed for %s: %s\n", 
  @@ -110,7 +110,7 @@
       fprintf(stdout,"OK\n");
   
       fprintf(stdout, "\tClient:  Creating new socket.......");
  -    if (apr_create_socket(&sock, destsa->sa.sin.sin_family, SOCK_STREAM,
  +    if (apr_create_socket(&sock, remote_sa->sa.sin.sin_family, SOCK_STREAM,
                             context) != APR_SUCCESS) {
           fprintf(stderr, "Couldn't create socket\n");
           exit(-1);
  @@ -119,7 +119,7 @@
   
       fprintf(stdout, "\tClient:  Connecting to socket.......");
   
  -    stat = apr_connect(sock, destsa);
  +    stat = apr_connect(sock, remote_sa);
   
       if (stat != APR_SUCCESS) {
           apr_close_socket(sock);
  @@ -140,10 +140,12 @@
           fprintf(stdout, "OK\n");
       }
   
  -    apr_get_ipaddr(&remote_ipaddr, APR_REMOTE, sock);
  -    apr_get_port(&remote_port, APR_REMOTE, sock);
  -    apr_get_ipaddr(&local_ipaddr, APR_LOCAL, sock);
  -    apr_get_port(&local_port, APR_LOCAL, sock);
  +    apr_get_sockaddr(&remote_sa, APR_REMOTE, sock);
  +    apr_get_ipaddr(&remote_ipaddr, remote_sa);
  +    apr_get_port(&remote_port, remote_sa);
  +    apr_get_sockaddr(&local_sa, APR_LOCAL, sock);
  +    apr_get_ipaddr(&local_ipaddr, local_sa);
  +    apr_get_port(&local_port, local_sa);
       fprintf(stdout, "\tClient socket: %s:%u -> %s:%u\n", local_ipaddr, local_port, remote_ipaddr,
remote_port);
   
       fprintf(stdout, "\tClient:  Trying to send data over socket.......");
  
  
  
  1.21      +8 -6      apr/test/server.c
  
  Index: server.c
  ===================================================================
  RCS file: /home/cvs/apr/test/server.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- server.c	2000/11/19 14:24:18	1.20
  +++ server.c	2000/11/21 19:15:27	1.21
  @@ -73,7 +73,7 @@
       const char *bind_to_ipaddr = NULL;
       char *local_ipaddr, *remote_ipaddr;
       apr_port_t local_port, remote_port;
  -    apr_sockaddr_t *localsa = NULL;
  +    apr_sockaddr_t *localsa = NULL, *remotesa;
       apr_status_t stat;
       int family = APR_UNSPEC;
       char buf[128];
  @@ -155,8 +155,8 @@
       fprintf(stdout, "OK\n");
   
       if (!localsa) {
  -        apr_set_port(sock, APR_LOCAL, 8021);
           apr_get_sockaddr(&localsa, APR_LOCAL, sock);
  +        apr_set_port(localsa, 8021);
       }
   
       fprintf(stdout, "\tServer:  Binding socket to port.......");
  @@ -203,10 +203,12 @@
       }
       fprintf(stdout, "OK\n");
   
  -    apr_get_ipaddr(&remote_ipaddr, APR_REMOTE, sock2);
  -    apr_get_port(&remote_port, APR_REMOTE, sock2);
  -    apr_get_ipaddr(&local_ipaddr, APR_LOCAL, sock2);
  -    apr_get_port(&local_port, APR_LOCAL, sock2);
  +    apr_get_sockaddr(&remotesa, APR_REMOTE, sock2);
  +    apr_get_ipaddr(&remote_ipaddr, remotesa);
  +    apr_get_port(&remote_port, remotesa);
  +    apr_get_sockaddr(&localsa, APR_LOCAL, sock2);
  +    apr_get_ipaddr(&local_ipaddr, localsa);
  +    apr_get_port(&local_port, localsa);
       fprintf(stdout, "\tServer socket: %s:%u -> %s:%u\n", local_ipaddr, local_port, remote_ipaddr,
remote_port);
   
       length = STRLEN;
  
  
  

Mime
View raw message