Socket setSoTimeout Example
Socket class setSoTimeout example. public void setSoTimeout(int timeout) throws SocketException Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on the InputStream associated with this Socket will block for only this amount of time.
|
| |
Socket setSoLinger Example
Socket class setSoLinger example. public void setSoLinger(boolean , int) throws SocketException Enable/disable SO_LINGER with the specified linger time in seconds. The maximum timeout value is platform specific. The setting only affects socket close.
|
| |
Socket setSocketImplFactory Example
Socket class setSocketImplFactory example. public static void setSocketImplFactory(SocketImplFactory fac) throws IOException Sets the client socket implementation factory for the application. The factory can be specified only once.
|
| |
Socket setSendBufferSize Example
Socket class setSendBufferSize example. setSendBufferSize public void setSendBufferSize(int size) throws SocketException Sets the SO_SNDBUF option to the specified value for this Socket. The SO_SNDBUF option is used by the platform's networking code as a hint for the size to set the underlying network I/O buffers.
|
| |
Socket GetReuseAddress Example
Socket class GetReuseAddress example. public void setReuseAddress(boolean on) throws SocketException Enable/disable the SO_REUSEADDR socket option. When a TCP connection is closed the connection may remain in a timeout state for a period of time after the connection is closed (typically known as the TIME_WAIT state or 2MSL wait state).
|
| |
Socket setReceiveBufferSize Example
Socket class setReceiveBufferSize example. ublic void setReceiveBufferSize(int size) throws SocketException Sets the SO_RCVBUF option to the specified value for this Socket. The SO_RCVBUF option is used by the platform's networking code as a hint for the size to set the underlying network I/O buffers.
|
| |
ServerSocket ToString() Example
ServerSocketclass ToString() method example. This example shows you how to use ToString() method.This method Returns the implementation address and implementation port of this socket as a String.
|
| |
ServerSocket SetSoTimeout() Example
ServerSocketclass SetSoTimeout() method example. This example shows you how to use SetSoTimeout() method.This method Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
|
| |
ServerSocket SetReuseAddress() Example
ServerSocketclass SetReuseAddress() method example. This example shows you how to use SetReuseAddress() method.This method Enable/disable the SO_REUSEADDR socket option.
|
| |
Socket setPerformancePreferences Example
Socket class setPerformancePreferences example. ublic void setPerformancePreferences(int connectionTime, int latency, int bandwidth) Sets performance preferences for this socket. Sockets use the TCP/IP protocol by default. Some implementations may offer alternative protocols which have different performance characteristics than TCP/IP.
|
| |
ServerSocket SetReceiveBufferSize() Example
ServerSocketclass SetReceiveBufferSize() method example. This example shows you how to use SetReceiveBufferSize() method.This method Sets a default proposed value for the SO_RCVBUF option for sockets accepted from this ServerSocket.
|
| |
Socket setOOBInline Example
Socket class setOOBInline example. public void setOOBInline(boolean on) throws SocketException Enable/disable OOBINLINE (receipt of TCP urgent data) By default, this option is disabled and TCP urgent data received on a socket is silently discarded.
|
| |
ServerSocket IsClosed() Example
ServerSocketclass IsClosed() method example. This example shows you how to use IsClosed() method.This method Returns the closed state of the ServerSocket.
|
| |
ServerSocket IsBound() Example
ServerSocketclass IsBound() method example. This example shows you how to use IsBound() method.This method Returns the binding state of the ServerSocket.
|
| |
Socket setKeepAlive Example
Socket class setKeepAlive example. blic void setKeepAlive(boolean on) throws SocketException Enable/disable SO_KEEPALIVE.
|
| |
ServerSocket GetSoTimeout() Example
ServerSocketclass GetSoTimeout() method example. This example shows you how to use GetSoTimeout() method.This method Retrieve setting for SO_TIMEOUT.
|
| |
ServerSocket GetReuseAddress() Example
ServerSocketclass GetReuseAddress() method example. This example shows you how to use GetReuseAddress() method.This method Tests if SO_REUSEADDR is enabled.
|
| |
ServerSocket GetReceiveBufferSize() Example
ServerSocketclass GetReceiveBufferSize() method example. This example shows you how to use GetReceiveBufferSize() method.This method Gets the value of the SO_RCVBUF option for this ServerSocket,
|
| |
ServerSocket GetLocalSocketAddress() Example
ServerSocketclass GetLocalSocketAddress() method example. This example shows you how to use GetLocalSocketAddress() method.This method Returns the address of the endpoint this socket is bound to, or null if it is not bound yet.
|
| |
Socket sendUrgentData Example
Socket class sendUrgentData example. public void sendUrgentData(int data) throws IOException Send one byte of urgent data on the socket. The byte to be sent is the lowest eight bits of the data parameter. The urgent byte is sent after any preceding writes to the socket OutputStream and before any future writes to the OutputStream.
|
| |
ServerSocket GetLocalPort() Example
ServerSocketclass GetLocalPort() method example. This example shows you how to use GetLocalPort() method.This method ServerSocketclass GetLocalPort() method example. This example shows you how to use GetLocalPort() method.This method
|
| |
Socket isOutputShutdown Example
Socket class isOutputShutdown example. public boolean isOutputShutdown() Returns whether the write-half of the socket connection is closed.
|
| |
ServerSocket GetInetAddress() Example
ServerSocketclass GetInetAddress() method example. This example shows you how to use GetInetAddress() method.This method Returns the local address of this server socket
|
| |
ServerSocket GetChannel() Example
ServerSocketclass GetChannel() method example. This example shows you how to use GetChannel() method.This method Returns the unique ServerSocketChannel object associated with this socket, if any.
|
| |
ServerSocket Close() Example
ServerSocketclass Close() method example. This example shows you how to use Close() method.This method Closes this socket.
|
| |
Socket isInputShutdown Example
Socket class isInputShutdown example. public boolean isInputShutdown() Returns whether the read-half of the socket connection is closed.
|
| |
InetAddress GetByAddress1() Example
InetAddressclass GetByAddress1() method example. This example shows you how to use GetByAddress1() method.This method Create an InetAddress based on the provided host name and IP address
|
| |
InetAddress GetByAddress() Example
InetAddressclass GetByAddress() method example. This example shows you how to use GetByAddress() method.This method Returns an InetAddress object given the raw IP address .
|
| |
DatagramSocket SetTrafficClass() Example
DatagramSocketclass SetTrafficClass() method example. This example shows you how to use SetTrafficClass() method.This method Sets traffic class or type-of-service octet in the IP datagram header for datagrams sent from this DatagramSocket
|
| |
DatagramSocket SetSoTimeout() Example
DatagramSocketclass SetSoTimeout() method example. This example shows you how to use SetSoTimeout() method.This method Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
|
| |
 |
1
2
3
4
5
6
7
8
9
10
11
[12]
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
|
|
| |