HOME

com.ireasoning.core.network
Interface TransportLayer

All Superinterfaces:
com.ireasoning.core.network.NetConst, Serializable

public interface TransportLayer
extends com.ireasoning.core.network.NetConst

This class represents the transport layer for client side Socket or DatagramSocket.


Field Summary
 
Fields inherited from interface com.ireasoning.core.network.NetConst
TCP, UDP
 
Method Summary
 void close()
           
 String getHostName()
           
 int getPort()
           
 int getReceiveBufferSize()
           
 int getType()
          Returns the type of transport layer.
 boolean isConnected()
           
 void open(String host, int port, InetAddress localAddr, int localPort)
          Creates a client-side socket and connects it to the specified port number on the named host.
 void open(String host, int port, InetAddress localAddr, int localPort, int connectionTimeout)
          Creates a client-side socket and connects it to the specified port number on the named host.
 int receive(TransportData data)
           
 void send(String str)
           
 void send(TransportData data)
           
 void setReceiveBufferSize(int size)
           
 void setTimeout(int timeout)
           
 void setTrafficClass(int tc)
          Sets traffic class or type-of-service octet in the IP datagram header As the underlying network implementation may ignore this value applications should consider it a hint.
 

Method Detail

send

public void send(TransportData data)
          throws IOException
Throws:
IOException

send

public void send(String str)
          throws IOException
Throws:
IOException

receive

public int receive(TransportData data)
            throws IOException
Returns:
number of bytes read
Throws:
IOException

open

public void open(String host,
                 int port,
                 InetAddress localAddr,
                 int localPort)
          throws IOException
Creates a client-side socket and connects it to the specified port number on the named host.

Parameters:
host - the host name.
port - the port number.
Throws:
IOException

open

public void open(String host,
                 int port,
                 InetAddress localAddr,
                 int localPort,
                 int connectionTimeout)
          throws IOException
Creates a client-side socket and connects it to the specified port number on the named host.

Parameters:
host - the host name.
port - the port number.
Throws:
IOException

close

public void close()

setTimeout

public void setTimeout(int timeout)
                throws SocketException
Throws:
SocketException

isConnected

public boolean isConnected()

setReceiveBufferSize

public void setReceiveBufferSize(int size)

getReceiveBufferSize

public int getReceiveBufferSize()

getHostName

public String getHostName()

getPort

public int getPort()

getType

public int getType()
Returns the type of transport layer.


setTrafficClass

public void setTrafficClass(int tc)
                     throws SocketException
Sets traffic class or type-of-service octet in the IP datagram header As the underlying network implementation may ignore this value applications should consider it a hint.

Parameters:
tc - an int value for the bitset.
Throws:
SocketException
See Also:
HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.