1 |
/* javanet.c - Common internal functions for the java.net package |
/* javanet.c - Common internal functions for the java.net package |
2 |
Copyright (C) 1998, 2002, 2004 Free Software Foundation, Inc. |
Copyright (C) 1998, 2002, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
1369 |
#endif /* not WITHOUT_NETWORK */ |
#endif /* not WITHOUT_NETWORK */ |
1370 |
} |
} |
1371 |
|
|
1372 |
|
void |
1373 |
|
_javanet_shutdownInput (JNIEnv *env, jobject this) |
1374 |
|
{ |
1375 |
|
int fd; |
1376 |
|
|
1377 |
|
assert (env != NULL); |
1378 |
|
assert ((*env) != NULL); |
1379 |
|
|
1380 |
|
/* Get the real file descriptor. */ |
1381 |
|
fd = _javanet_get_int_field (env, this, "native_fd"); |
1382 |
|
if (fd == -1) |
1383 |
|
{ |
1384 |
|
JCL_ThrowException(env, SOCKET_EXCEPTION, |
1385 |
|
"Internal error: _javanet_get_option(): no native file descriptor"); |
1386 |
|
return; |
1387 |
|
} |
1388 |
|
|
1389 |
|
/* Shutdown input stream of socket. */ |
1390 |
|
if (shutdown (fd, SHUT_RD) == -1) |
1391 |
|
{ |
1392 |
|
JCL_ThrowException (env, SOCKET_EXCEPTION, |
1393 |
|
"Can't shutdown input of socket"); |
1394 |
|
return; |
1395 |
|
} |
1396 |
|
} |
1397 |
|
|
1398 |
|
void |
1399 |
|
_javanet_shutdownOutput (JNIEnv *env, jobject this) |
1400 |
|
{ |
1401 |
|
int fd; |
1402 |
|
|
1403 |
|
assert (env != NULL); |
1404 |
|
assert ((*env) != NULL); |
1405 |
|
|
1406 |
|
/* Get the real file descriptor. */ |
1407 |
|
fd = _javanet_get_int_field (env, this, "native_fd"); |
1408 |
|
if (fd == -1) |
1409 |
|
{ |
1410 |
|
JCL_ThrowException(env, SOCKET_EXCEPTION, |
1411 |
|
"Internal error: _javanet_get_option(): no native file descriptor"); |
1412 |
|
return; |
1413 |
|
} |
1414 |
|
|
1415 |
|
/* Shutdown output stream of socket. */ |
1416 |
|
if (shutdown (fd, SHUT_WR) == -1) |
1417 |
|
{ |
1418 |
|
JCL_ThrowException (env, SOCKET_EXCEPTION, |
1419 |
|
"Can't shutdown output of socket"); |
1420 |
|
return; |
1421 |
|
} |
1422 |
|
} |
1423 |
|
|
1424 |
/* end of file */ |
/* end of file */ |