home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.protocols.tcp-ip
- Path: sparky!uunet!destroyer!gumby!wmu-coyote!rustomji
- From: rustomji@sol.cs.wmich.edu (Eric Rustomji)
- Subject: Help: getpeername(), getsockname() calls
- Message-ID: <1992Dec13.183114.9239@sol.cs.wmich.edu>
- Keywords: SOCKET SYSTEM CALLS
- Organization: Western Michigan University
- Distribution: usa
- Date: Sun, 13 Dec 1992 18:31:14 GMT
- Lines: 42
-
- Hi there,
-
- I was trying to use the BSD socket calls, on my client-server
- project:
-
- getpeername(s, name, namelen)
- int s;
- struct sockaddr *name;
- int *namelen;
-
- where, I allocated:
- struct sockaddr clnt_name;
- int clnt_name_len;
-
- main()
- {
- .
- .
- clnt_name_len = sizeof(clnt_name);
- getpeername(sockfd, &clnt_name, &clnt_name_len);
- .
- .
- }
-
- I observed that after the getpeername() call, the variable clnt_name
- contains this:
-
- clnt_name.sa_family = 2
- clnt_name.sa_data = "p ( >" --->> ????
-
- Could anyone let me know, whats happening here. I dont seem to
- be getting the endpoint connection/remote address of the socket.
-
- I would appreciate if any ideas/reference could be sent to me ASAP
- at my email address:
- rustomji@cs.wmich.edu
-
- Thanks a bunch! Happy Holidays !!
-
- --
- Eric
-
-