you have to use :
socket, bind, listen, accept functions and the sockaddr_in structure at least!
first you have to create a socket witch will be you listening_access_point ( _lap )
_lap = socket (AF_INET, SOCK_STREAM, 0)
than you set the sockaddr_in structure
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = port;
then you bind your _lap to an address
bind (_lap, (struct sockaddr *)&serv_addr,
sizeof (struct sockaddr_in)) < 0)
than you begin listening at that address
listen (_lap, GRA_GN_MAX_TCP_BACKLOG) < 0)
in this example accept is a blocking call returning only when i client attepts a connect call to your address
ssn = accept (_lap, (struct sockaddr *)&addr,
(GRA_sSize *) &len);
ssn is the session you have with the client
have a look on man pages for dettail
Hope it helped!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.