public class UdpSend extends Object implements AutoCloseable
Modifier and Type | Method and Description |
---|---|
UdpSend |
bufferSize(int bufferSize) |
void |
close() |
DatagramSocket |
getDatagramSocket() |
String |
getHost() |
InetAddress |
getInetAddress() |
int |
getPort() |
UdpSend |
send(byte[] bs) |
UdpSend |
send(byte[] bs,
int len) |
UdpSend |
send(byte[] bs,
int off,
int len)
发送数据
|
UdpSend |
sendLf()
发送 \n
|
UdpSend |
timeout(int timeOut) |
public UdpSend(String host, int port)
public UdpSend bufferSize(int bufferSize) throws SocketException
SocketException
public UdpSend timeout(int timeOut) throws SocketException
SocketException
public UdpSend send(byte[] bs) throws IOException
IOException
public UdpSend send(byte[] bs, int len) throws IOException
IOException
public UdpSend send(byte[] bs, int off, int len) throws IOException
bs
- bytesoff
- offsetlen
- lengthIOException
- IOExceptionpublic UdpSend sendLf() throws IOException
IOException
- IOExceptionpublic void close()
close
in interface AutoCloseable
public String getHost()
public int getPort()
public InetAddress getInetAddress()
public DatagramSocket getDatagramSocket()
Copyright © 2024. All rights reserved.