-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public class PseudoTcpSocket extends Socket
-
-
Method Summary
Modifier and Type Method Description longgetConversationID()voidsetConversationID(long convID)Set conversation ID for the socket Must be called on unconnected socket voidsetMTU(int mtu)Sets MTU (maximum transmission unit) value intgetMTU()Gets MTU (maximum transmission unit) value longgetOption(Option option)Sets an Option on this socket. voidsetOption(Option option, long optValue)voidaccept(int timeout)Blocking method waits for connection. voidsetDebugName(String debugName)Sets debug name that will be displayed in log messages for this socket PseudoTcpStategetState()Returns current PseudoTcpState of this socket booleanisConnected()booleanisConnecting()booleanisClosed()voidconnect(SocketAddress endpoint)Connects without the timeout. voidconnect(SocketAddress remoteAddr, int timeout)On Android, we must not use the default connect implementation, because that one deals directly with physical resources, while we create a socket on top of another socket. synchronized voidclose()OutputStreamgetOutputStream()voidaccept(SocketAddress remoteAddress, int timeout)Allows to set up the remote address directly. FileDescriptorgetFileDescriptor()Return the FileDescriptor of the underlying socket. -
Methods inherited from class java.net.Socket
bind, getChannel, getInetAddress, getInputStream, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOption, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setOption, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setSoTimeout, setSocketImplFactory, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, supportedOptions, toString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getConversationID
long getConversationID()
-
setConversationID
void setConversationID(long convID)
Set conversation ID for the socket Must be called on unconnected socket
- Parameters:
convID- the conversation ID to set
-
setMTU
void setMTU(int mtu)
Sets MTU (maximum transmission unit) value
- Parameters:
mtu- the MTU value
-
getMTU
int getMTU()
Gets MTU (maximum transmission unit) value
-
getOption
long getOption(Option option)
Sets an Option on this socket.
- Parameters:
option- the option to set on this socket.
-
setOption
void setOption(Option option, long optValue)
- Parameters:
option- PseudoTCP option to setoptValue- option's value
-
accept
void accept(int timeout)
Blocking method waits for connection.
- Parameters:
timeout- for this operation in ms
-
setDebugName
void setDebugName(String debugName)
Sets debug name that will be displayed in log messages for this socket
- Parameters:
debugName- the name of this socket for debug messages
-
getState
PseudoTcpState getState()
Returns current PseudoTcpState of this socket
-
isConnected
boolean isConnected()
-
isConnecting
boolean isConnecting()
-
isClosed
boolean isClosed()
-
connect
void connect(SocketAddress endpoint)
Connects without the timeout.
-
connect
void connect(SocketAddress remoteAddr, int timeout)
On Android, we must not use the default connect implementation, because that one deals directly with physical resources, while we create a socket on top of another socket.
-
close
synchronized void close()
-
getOutputStream
OutputStream getOutputStream()
-
accept
void accept(SocketAddress remoteAddress, int timeout)
Allows to set up the remote address directly. Otherwise, when using the other accept methods, the first address from which a packet is received, is considered the remote address.
- Parameters:
remoteAddress- the one and only remote address that will be accepted as remote packet's sourcetimeout- connection accept timeout value in milliseconds, after which the exception will be thrown.
-
getFileDescriptor
FileDescriptor getFileDescriptor()
Return the FileDescriptor of the underlying socket.
-
-
-
-