apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norman Tuttle <nltut...@gmail.com>
Subject Using apr on Win32 to create a telnet server on Win32: what am I missing?
Date Mon, 25 Jul 2005 23:13:55 GMT
Followed the textbook prescription for creating a TCP/IP server using UNIX API:
create_socket followed by bind, followed by listen, then accept.
Attempted this to create a telnet server (got socket descriptor for
localhost's port 23) using apr library and under Win32 system (using a
WinNT 4.0 OS). I cannot get past the accept call, and nothing will
connect to this IP address using telnet when it is in the accept call.
What am I doing wrong? I am sure it is getting to all the steps up to
the telnet call, because I added sentinel functions to make sure it
got there. Below is the snippet of code that should activate the
server: What am I missing?

    if ((rv = apr_sockaddr_info_get(&sa, "localhost", APR_INET,
                                    23, 0, pool)) == APR_SUCCESS)
      if (((rv = apr_socket_create(&socket, APR_INET, SOCK_STREAM,
                                  APR_PROTO_TCP, pool)) == APR_SUCCESS)&&
          (apr_socket_bind(socket, sa)==APR_SUCCESS)&&
		  (apr_socket_listen(socket, 1)==APR_SUCCESS)&&		 
(apr_socket_opt_set(socket, APR_SO_REUSEADDR, 1)==APR_SUCCESS)&&
          (apr_socket_accept(&socket, socket, pool)==APR_SUCCESS))

-Norman Tuttle, Software Engineer  NLTuttle@gmail.com

View raw message