public class TcpipSMBNetworkSession extends NetworkSession
Contains the details of a connection to a remote file server that has used the native SMB protocol of port 445 to connect to the remote server.
Contains methods for sending/receiving SMB/CIFS requests/responses using native SMB.
Constructor and Description |
---|
TcpipSMBNetworkSession()
Default constructor
|
TcpipSMBNetworkSession(int tmo)
Class constructor
|
TcpipSMBNetworkSession(int tmo,
int port)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
void |
Close()
Close the network session
|
boolean |
hasData()
Check if there is data available on this network session
|
boolean |
isConnected()
Determine if the session is connected to a remote host
|
void |
Open(java.lang.String toName,
java.lang.String fromName,
java.lang.String toAddr)
Open a connection to a remote host
|
int |
Receive(byte[] buf)
Receive a data packet from the remote host.
|
boolean |
Send(byte[] data,
int siz)
Send a data packet to the remote host.
|
static void |
setDebug(boolean dbg)
Enable/disable session debugging output
|
void |
setTimeout(int tmo)
Set the socket timeout
|
getDefaultTimeout, getProtocolName, getTimeout, setDefaultTimeout
public TcpipSMBNetworkSession()
public TcpipSMBNetworkSession(int tmo)
tmo
- Socket timeout, in millisecondspublic TcpipSMBNetworkSession(int tmo, int port)
tmo
- Socket timeout, in millisecondsport
- Session port to connect to on the serverpublic void Open(java.lang.String toName, java.lang.String fromName, java.lang.String toAddr) throws java.io.IOException, java.net.UnknownHostException
Open
in class NetworkSession
toName
- Host name/address being calledfromName
- Local host name/addresstoAddr
- Optional addressjava.io.IOException
java.net.UnknownHostException
public boolean isConnected()
isConnected
in class NetworkSession
public final boolean hasData() throws java.io.IOException
hasData
in class NetworkSession
java.io.IOException
public int Receive(byte[] buf) throws java.io.IOException
Receive
in class NetworkSession
buf
- Byte buffer to receive the data into.java.io.IOException
- I/O error occurred.public boolean Send(byte[] data, int siz) throws java.io.IOException
Send
in class NetworkSession
data
- Byte array containing the data to be sent.siz
- Length of the data to send.java.io.IOException
- I/O error occurred.public void Close() throws java.io.IOException
Close
in class NetworkSession
java.io.IOException
- I/O error occurredpublic void setTimeout(int tmo)
setTimeout
in class NetworkSession
tmo
- intpublic static void setDebug(boolean dbg)
dbg
- true to enable debugging, else falseCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.