udt
Class UDTSocket

java.lang.Object
  extended by java.net.Socket
      extended by udt.UDTSocket

public class UDTSocket
extends Socket

UDTSocket is analogous to a normal java.net.Socket, it provides input and output streams for the application TODO is it possible to actually extend java.net.Socket ?


Constructor Summary
UDTSocket(UDPEndPoint endpoint, UDTSession session)
           
 
Method Summary
 void bind(SocketAddress address)
           
 void close()
           
 void connect(SocketAddress address)
           
 void connect(SocketAddress address, int timeout)
           
protected  void doWrite(byte[] data)
          write single block of data without waiting for any acknowledgement
protected  void doWrite(byte[] data, int offset, int length)
          write the given data
protected  void doWrite(byte[] data, int offset, int length, int timeout, TimeUnit units)
          write the given data, waiting at most for the specified time if the queue is full
protected  void doWriteBlocking(byte[] data)
           
protected  void flush()
          will block until the outstanding packets have really been sent out and acknowledged
 SocketChannel getChannel()
           
 UDPEndPoint getEndpoint()
           
 InetAddress getInetAddress()
           
 InputStream getInputStream()
           
 boolean getKeepAlive()
           
 InetAddress getLocalAddress()
           
 int getLocalPort()
           
 SocketAddress getLocalSocketAddress()
           
 boolean getOOBInline()
           
 OutputStream getOutputStream()
           
 int getPort()
           
 int getReceiveBufferSize()
           
 UDTReceiver getReceiver()
           
 SocketAddress getRemoteSocketAddress()
           
 boolean getReuseAddress()
           
 int getSendBufferSize()
           
 UDTSender getSender()
           
 UDTSession getSession()
           
 int getSoLinger()
           
 int getSoTimeout()
           
 boolean getTcpNoDelay()
           
 int getTrafficClass()
           
 boolean isActive()
           
 boolean isBound()
           
 boolean isClosed()
           
 boolean isConnected()
           
 boolean isInputShutdown()
           
 boolean isOutputShutdown()
           
 void sendUrgentData(int data)
           
 void setKeepAlive(boolean on)
           
 void setOOBInline(boolean on)
           
 void setPerformancePreferences(int connectionTime, int latency, int bandwidth)
           
 void setReceiveBufferSize(int size)
           
 void setReceiver(UDTReceiver receiver)
           
 void setReuseAddress(boolean on)
           
 void setSendBufferSize(int size)
           
 void setSender(UDTSender sender)
           
 void setSoLinger(boolean on, int linger)
           
 void setSoTimeout(int timeout)
           
 void setTcpNoDelay(boolean on)
           
 void setTrafficClass(int tc)
           
 void shutdownInput()
           
 void shutdownOutput()
           
 
Methods inherited from class java.net.Socket
setSocketImplFactory, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UDTSocket

public UDTSocket(UDPEndPoint endpoint,
                 UDTSession session)
          throws SocketException
Parameters:
host -
port -
endpoint -
Throws:
SocketException,UnknownHostException
SocketException
Method Detail

getReceiver

public UDTReceiver getReceiver()

setReceiver

public void setReceiver(UDTReceiver receiver)

getSender

public UDTSender getSender()

setSender

public void setSender(UDTSender sender)

isActive

public boolean isActive()

getEndpoint

public UDPEndPoint getEndpoint()

getSession

public final UDTSession getSession()

doWrite

protected void doWrite(byte[] data)
                throws IOException
write single block of data without waiting for any acknowledgement

Parameters:
data -
Throws:
IOException

doWrite

protected void doWrite(byte[] data,
                       int offset,
                       int length)
                throws IOException
write the given data

Parameters:
data - - the data array
offset - - the offset into the array
length - - the number of bytes to write
Throws:
IOException

doWrite

protected void doWrite(byte[] data,
                       int offset,
                       int length,
                       int timeout,
                       TimeUnit units)
                throws IOException,
                       InterruptedException
write the given data, waiting at most for the specified time if the queue is full

Parameters:
data -
offset -
length -
timeout -
units -
Throws:
IOException - - if data cannot be sent
InterruptedException

flush

protected void flush()
              throws InterruptedException
will block until the outstanding packets have really been sent out and acknowledged

Throws:
InterruptedException

doWriteBlocking

protected void doWriteBlocking(byte[] data)
                        throws IOException,
                               InterruptedException
Throws:
IOException
InterruptedException

bind

public void bind(SocketAddress address)
          throws IOException
Overrides:
bind in class Socket
Throws:
IOException

close

public void close()
           throws IOException
Overrides:
close in class Socket
Throws:
IOException

connect

public void connect(SocketAddress address)
             throws IOException
Overrides:
connect in class Socket
Throws:
IOException

connect

public void connect(SocketAddress address,
                    int timeout)
             throws IOException
Overrides:
connect in class Socket
Throws:
IOException

getChannel

public SocketChannel getChannel()
Overrides:
getChannel in class Socket

getInetAddress

public InetAddress getInetAddress()
Overrides:
getInetAddress in class Socket

getInputStream

public InputStream getInputStream()
                           throws IOException
Overrides:
getInputStream in class Socket
Throws:
IOException

getKeepAlive

public boolean getKeepAlive()
                     throws SocketException
Overrides:
getKeepAlive in class Socket
Throws:
SocketException

getLocalAddress

public InetAddress getLocalAddress()
Overrides:
getLocalAddress in class Socket

getLocalPort

public int getLocalPort()
Overrides:
getLocalPort in class Socket

getLocalSocketAddress

public SocketAddress getLocalSocketAddress()
Overrides:
getLocalSocketAddress in class Socket

getOOBInline

public boolean getOOBInline()
                     throws SocketException
Overrides:
getOOBInline in class Socket
Throws:
SocketException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Overrides:
getOutputStream in class Socket
Throws:
IOException

getPort

public int getPort()
Overrides:
getPort in class Socket

getReceiveBufferSize

public int getReceiveBufferSize()
                         throws SocketException
Overrides:
getReceiveBufferSize in class Socket
Throws:
SocketException

getRemoteSocketAddress

public SocketAddress getRemoteSocketAddress()
Overrides:
getRemoteSocketAddress in class Socket

getReuseAddress

public boolean getReuseAddress()
                        throws SocketException
Overrides:
getReuseAddress in class Socket
Throws:
SocketException

getSendBufferSize

public int getSendBufferSize()
                      throws SocketException
Overrides:
getSendBufferSize in class Socket
Throws:
SocketException

getSoLinger

public int getSoLinger()
                throws SocketException
Overrides:
getSoLinger in class Socket
Throws:
SocketException

getSoTimeout

public int getSoTimeout()
                 throws SocketException
Overrides:
getSoTimeout in class Socket
Throws:
SocketException

getTcpNoDelay

public boolean getTcpNoDelay()
                      throws SocketException
Overrides:
getTcpNoDelay in class Socket
Throws:
SocketException

getTrafficClass

public int getTrafficClass()
                    throws SocketException
Overrides:
getTrafficClass in class Socket
Throws:
SocketException

isBound

public boolean isBound()
Overrides:
isBound in class Socket

isClosed

public boolean isClosed()
Overrides:
isClosed in class Socket

isConnected

public boolean isConnected()
Overrides:
isConnected in class Socket

isInputShutdown

public boolean isInputShutdown()
Overrides:
isInputShutdown in class Socket

isOutputShutdown

public boolean isOutputShutdown()
Overrides:
isOutputShutdown in class Socket

sendUrgentData

public void sendUrgentData(int data)
                    throws IOException
Overrides:
sendUrgentData in class Socket
Throws:
IOException

setKeepAlive

public void setKeepAlive(boolean on)
                  throws SocketException
Overrides:
setKeepAlive in class Socket
Throws:
SocketException

setOOBInline

public void setOOBInline(boolean on)
                  throws SocketException
Overrides:
setOOBInline in class Socket
Throws:
SocketException

setPerformancePreferences

public void setPerformancePreferences(int connectionTime,
                                      int latency,
                                      int bandwidth)
Overrides:
setPerformancePreferences in class Socket

setReceiveBufferSize

public void setReceiveBufferSize(int size)
                          throws SocketException
Overrides:
setReceiveBufferSize in class Socket
Throws:
SocketException

setReuseAddress

public void setReuseAddress(boolean on)
                     throws SocketException
Overrides:
setReuseAddress in class Socket
Throws:
SocketException

setSendBufferSize

public void setSendBufferSize(int size)
                       throws SocketException
Overrides:
setSendBufferSize in class Socket
Throws:
SocketException

setSoLinger

public void setSoLinger(boolean on,
                        int linger)
                 throws SocketException
Overrides:
setSoLinger in class Socket
Throws:
SocketException

setSoTimeout

public void setSoTimeout(int timeout)
                  throws SocketException
Overrides:
setSoTimeout in class Socket
Throws:
SocketException

setTcpNoDelay

public void setTcpNoDelay(boolean on)
                   throws SocketException
Overrides:
setTcpNoDelay in class Socket
Throws:
SocketException

setTrafficClass

public void setTrafficClass(int tc)
                     throws SocketException
Overrides:
setTrafficClass in class Socket
Throws:
SocketException

shutdownInput

public void shutdownInput()
                   throws IOException
Overrides:
shutdownInput in class Socket
Throws:
IOException

shutdownOutput

public void shutdownOutput()
                    throws IOException
Overrides:
shutdownOutput in class Socket
Throws:
IOException


Copyright © 2013 LittleShoot. All Rights Reserved.