public class UDPTransport extends Object implements ClientTransport
Constructor and Description |
---|
UDPTransport()
Creates UDP transport.
|
UDPTransport(String multicastAddress,
int port)
Creates UDP transport.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the transport.
|
String |
getAddress()
Getter for address value.
|
InetAddress |
getInetAddress()
Getter for address value.
|
int |
getLocalPort()
Getter for local port value.
|
int |
getPort()
Getter for port value.
|
boolean |
isBlockingSocket() |
boolean |
isOpen()
Returns true if, transport is open.
|
void |
open()
Method opens the transport.
|
int |
read(byte[] buffer)
Transport dependent read method.
|
int |
read(byte[] buffer,
int offset,
int length)
Transport dependent read method.
|
int |
read(ByteBuffer buffer) |
int |
read(ByteBuffer buffer,
int offset,
int length) |
void |
setAddress(String multicastAddress)
Setter for multicat address.
|
void |
setBufferSize(int bufferSize) |
void |
setNetworkInterfaceName(String networkInterface)
Setter for network interface.
|
void |
setPort(int port)
Setter for port.
|
void |
setSocketFactory(SocketFactory socketFactory) |
void |
waitUntilReadyToWrite() |
void |
write(byte[] message)
Transport dependent write method.
|
int |
write(byte[] message,
int offset,
int length)
Transport dependent write method.
|
int |
write(ByteBuffer buffer) |
int |
write(ByteBuffer buffer,
int offset,
int length) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSSLCertificates, getSSLCipherSuite, getSSLProtocol
public UDPTransport()
public UDPTransport(String multicastAddress, int port)
multicastAddress
- the multicast addressport
- the transport portpublic void setSocketFactory(SocketFactory socketFactory)
setSocketFactory
in interface ClientTransport
public boolean isBlockingSocket()
isBlockingSocket
in interface Transport
public void setNetworkInterfaceName(String networkInterface)
networkInterface
- public void setBufferSize(int bufferSize)
public void setAddress(String multicastAddress)
setAddress
in interface ClientTransport
multicastAddress
- the multicat addresspublic void setPort(int port)
setPort
in interface ClientTransport
port
- the transport portpublic void open() throws IOException
open
in interface Transport
IOException
- - if an I/O error occurs.public void close() throws IOException
close
in interface Transport
IOException
- - if an I/O error occurs.public boolean isOpen()
Transport
isOpen
in interface Transport
Transport.isOpen()
public void write(byte[] message) throws IOException
Transport
write
in interface Transport
message
- actual messageIOException
- if unable to writeTransport.write(byte[])
public int write(byte[] message, int offset, int length) throws IOException
Transport
write
in interface Transport
message
- actual messageoffset
- the offset in bufferlength
- the num of bytes to writeIOException
- if unable to writepublic int read(byte[] buffer) throws IOException
Transport
read
in interface Transport
buffer
- holder for read bytesIOException
- if unable to readTransport.read(byte[])
public int read(byte[] buffer, int offset, int length) throws IOException
Transport
read
in interface Transport
buffer
- holder for read bytesoffset
- in bufferlength
- maximum bytes to be readIOException
- if unable to readTransport.read(byte[], int, int)
public String getAddress()
Transport
getAddress
in interface Transport
Transport.getAddress()
public InetAddress getInetAddress()
Transport
getInetAddress
in interface Transport
public int getPort()
Transport
getPort
in interface Transport
Transport.getPort()
public int getLocalPort()
Transport
getLocalPort
in interface Transport
public int write(ByteBuffer buffer) throws IOException
write
in interface ClientTransport
write
in interface Transport
IOException
public int write(ByteBuffer buffer, int offset, int length) throws IOException
write
in interface ClientTransport
write
in interface Transport
IOException
public int read(ByteBuffer buffer, int offset, int length) throws IOException
read
in interface ClientTransport
read
in interface Transport
IOException
public int read(ByteBuffer buffer) throws IOException
read
in interface ClientTransport
read
in interface Transport
IOException
public void waitUntilReadyToWrite() throws IOException
waitUntilReadyToWrite
in interface Transport
IOException
Copyright © 2000–2022 EPAM Systems. All rights reserved.