MCPcopy Create free account
hub / github.com/ReadyTalk/avian / accept

Function accept

classpath/sockets.cpp:100–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100SOCKET accept(JNIEnv* e, SOCKET sock, long* client_addr, short* client_port)
101{
102 sockaddr_in adr;
103 SOCKET client_socket = ::accept(sock, (sockaddr*)&adr, NULL);
104 if (INVALID_SOCKET == client_socket) {
105 char buf[255];
106 sprintf(buf,
107 "Can't accept the incoming connection. System error: %d",
108 last_socket_error());
109 throwNew(e, "java/io/IOException", buf);
110 return INVALID_SOCKET;
111 }
112
113 if (client_addr != NULL) {
114#ifdef PLATFORM_WINDOWS
115 *client_addr = ntohl(adr.sin_addr.S_un.S_addr);
116#else
117 *client_addr = ntohl(adr.sin_addr.s_addr);
118#endif
119 }
120
121 if (client_port != NULL) {
122 *client_port = ntohs(adr.sin_port);
123 }
124
125 return client_socket;
126}
127
128void send(JNIEnv* e, SOCKET sock, const char* buff_ptr, int buff_size)
129{

Callers 3

EXPORT(JVM_Accept)Function · 0.85
pickSourceSiteFunction · 0.85
doAcceptFunction · 0.85

Calls 2

last_socket_errorFunction · 0.85
throwNewFunction · 0.70

Tested by

no test coverage detected