MCPcopy Create free account
hub / github.com/SimHacker/micropolis / tcpClientObjectServerCmd

Function tcpClientObjectServerCmd

micropolis-activity/src/tk/tktcp.c:2079–2097  ·  view source on GitHub ↗
(clientData, interp, argc, argv)

Source from the content-addressed store, hash-verified

2077
2078 struct hostent * hostdesc;
2079
2080 if (argc != 1) {
2081 Tcl_AppendResult (interp, "wrong # args: should be \"", argv [-1], " ",
2082 argv [0], "\"", (char *) NULL);
2083 return TCL_ERROR;
2084 }
2085
2086 hostdesc = gethostbyaddr ((char *) &(client -> peeraddr.sin_addr.s_addr),
2087 sizeof (client -> peeraddr.sin_addr.s_addr),
2088 AF_INET);
2089
2090 if (hostdesc != (struct hostent *) NULL) {
2091 Tcl_SetResult (interp, hostdesc -> h_name, TCL_VOLATILE);
2092 } else {
2093 Tcl_SetResult (interp, inet_ntoa (client -> peeraddr.sin_addr),
2094 TCL_VOLATILE);
2095 }
2096
2097 return TCL_OK;
2098}
2099
2100

Callers 1

tcpClientObjectCmdFunction · 0.85

Calls 2

Tcl_AppendResultFunction · 0.85
Tcl_SetResultFunction · 0.85

Tested by

no test coverage detected