310 } |
310 } |
311 |
311 |
312 public void setSendBufferSize(int size) throws SocketException { |
312 public void setSendBufferSize(int size) throws SocketException { |
313 if (size <= 0) |
313 if (size <= 0) |
314 throw new IllegalArgumentException("Invalid send size"); |
314 throw new IllegalArgumentException("Invalid send size"); |
315 setIntOption(StandardSocketOption.SO_SNDBUF, size); |
315 setIntOption(StandardSocketOptions.SO_SNDBUF, size); |
316 } |
316 } |
317 |
317 |
318 public int getSendBufferSize() throws SocketException { |
318 public int getSendBufferSize() throws SocketException { |
319 return getIntOption(StandardSocketOption.SO_SNDBUF); |
319 return getIntOption(StandardSocketOptions.SO_SNDBUF); |
320 } |
320 } |
321 |
321 |
322 public void setReceiveBufferSize(int size) throws SocketException { |
322 public void setReceiveBufferSize(int size) throws SocketException { |
323 if (size <= 0) |
323 if (size <= 0) |
324 throw new IllegalArgumentException("Invalid receive size"); |
324 throw new IllegalArgumentException("Invalid receive size"); |
325 setIntOption(StandardSocketOption.SO_RCVBUF, size); |
325 setIntOption(StandardSocketOptions.SO_RCVBUF, size); |
326 } |
326 } |
327 |
327 |
328 public int getReceiveBufferSize() throws SocketException { |
328 public int getReceiveBufferSize() throws SocketException { |
329 return getIntOption(StandardSocketOption.SO_RCVBUF); |
329 return getIntOption(StandardSocketOptions.SO_RCVBUF); |
330 } |
330 } |
331 |
331 |
332 public void setReuseAddress(boolean on) throws SocketException { |
332 public void setReuseAddress(boolean on) throws SocketException { |
333 setBooleanOption(StandardSocketOption.SO_REUSEADDR, on); |
333 setBooleanOption(StandardSocketOptions.SO_REUSEADDR, on); |
334 } |
334 } |
335 |
335 |
336 public boolean getReuseAddress() throws SocketException { |
336 public boolean getReuseAddress() throws SocketException { |
337 return getBooleanOption(StandardSocketOption.SO_REUSEADDR); |
337 return getBooleanOption(StandardSocketOptions.SO_REUSEADDR); |
338 |
338 |
339 } |
339 } |
340 |
340 |
341 public void setBroadcast(boolean on) throws SocketException { |
341 public void setBroadcast(boolean on) throws SocketException { |
342 setBooleanOption(StandardSocketOption.SO_BROADCAST, on); |
342 setBooleanOption(StandardSocketOptions.SO_BROADCAST, on); |
343 } |
343 } |
344 |
344 |
345 public boolean getBroadcast() throws SocketException { |
345 public boolean getBroadcast() throws SocketException { |
346 return getBooleanOption(StandardSocketOption.SO_BROADCAST); |
346 return getBooleanOption(StandardSocketOptions.SO_BROADCAST); |
347 } |
347 } |
348 |
348 |
349 public void setTrafficClass(int tc) throws SocketException { |
349 public void setTrafficClass(int tc) throws SocketException { |
350 setIntOption(StandardSocketOption.IP_TOS, tc); |
350 setIntOption(StandardSocketOptions.IP_TOS, tc); |
351 } |
351 } |
352 |
352 |
353 public int getTrafficClass() throws SocketException { |
353 public int getTrafficClass() throws SocketException { |
354 return getIntOption(StandardSocketOption.IP_TOS); |
354 return getIntOption(StandardSocketOptions.IP_TOS); |
355 } |
355 } |
356 |
356 |
357 public void close() { |
357 public void close() { |
358 try { |
358 try { |
359 dc.close(); |
359 dc.close(); |