|
|||||||||
| Home >> All >> com >> act365 >> [ net overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.act365.net
Class SocketUtils

java.lang.Objectcom.act365.net.SocketUtils
- public class SocketUtils
- extends java.lang.Object
SocketUtils provides various utility functions e.g. checksum calculations, functions to read and write numbers from bytestreams and a bytestream dump printer.
| Field Summary | |
(package private) static boolean |
includeheader
|
(package private) static int |
protocol
The protocol in use in the current session. |
| Constructor Summary | |
SocketUtils()
|
|
| Method Summary | |
static short |
checksum(byte[] source,
byte[] destination,
byte protocol,
short length,
byte[] message,
int offset)
Specific checksum calculation used for the UDP and TCP pseudo-header. |
static short |
checksum(byte[] message,
int length,
int offset)
Standard internet checksum algorithm shared by IP, ICMP, UDP and TCP. |
static void |
dump(java.io.PrintStream printer,
byte[] buffer,
int offset,
int count)
Dumps a buffer in printable form. |
static int |
getProtocol()
Returns the protocol associated with the current DatagramSocketImpl. |
static boolean |
includeHeader()
Indicates whether the chosen protocol requires the user to include the IP header. |
(package private) static long |
integralFromBytes(byte[] buffer,
int offset,
int length)
Forms an integral type from consecutive bytes in a buffer |
static int |
intFromBytes(byte[] buffer,
int offset)
Converts consecutive bytes from a buffer into an int. |
static void |
intToBytes(int value,
byte[] buffer,
int offset)
Writes an int into a buffer. |
static long |
longFromBytes(byte[] buffer,
int offset)
Converts consecutive bytes from a buffer into a long. |
static void |
longToBytes(long value,
byte[] buffer,
int offset)
Writes a long into a buffer. |
static void |
setProtocol(java.lang.String protocollabel)
Sets the DatagramSocket factory to be used in the program. |
static short |
shortFromBytes(byte[] buffer,
int offset)
Converts consecutive bytes from a buffer into a short. |
static void |
shortToBytes(short value,
byte[] buffer,
int offset)
Writes a short into a buffer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protocol
static int protocol
- The protocol in use in the current session.
includeheader
static boolean includeheader
| Constructor Detail |
SocketUtils
public SocketUtils()
| Method Detail |
setProtocol
public static void setProtocol(java.lang.String protocollabel) throws java.io.IOException
- Sets the
DatagramSocketfactory to be used in the program. The TCP, TCP/J, UDP and ICMP protocols are supported. TCP/J is a clone of TCP that uses the IP protocol code 152. The addition of the Raw prefix to the protocol name indicates that the user wishes to write his own IP headers for the socket. (The option is not supported on Windows). TheSocketandServerSocketfactory objects will be set for TCP-based protocols.
getProtocol
public static int getProtocol()
- Returns the protocol associated with the current
DatagramSocketImpl.
includeHeader
public static boolean includeHeader()
- Indicates whether the chosen protocol requires the user to include the IP header.
checksum
public static short checksum(byte[] message,
int length,
int offset)
- Standard internet checksum algorithm shared by IP, ICMP, UDP and TCP.
checksum
public static short checksum(byte[] source,
byte[] destination,
byte protocol,
short length,
byte[] message,
int offset)
- Specific checksum calculation used for the UDP and TCP pseudo-header.
integralFromBytes
static long integralFromBytes(byte[] buffer,
int offset,
int length)
- Forms an integral type from consecutive bytes in a buffer
shortFromBytes
public static short shortFromBytes(byte[] buffer,
int offset)
- Converts consecutive bytes from a buffer into a short.
intFromBytes
public static int intFromBytes(byte[] buffer,
int offset)
- Converts consecutive bytes from a buffer into an int.
longFromBytes
public static long longFromBytes(byte[] buffer,
int offset)
- Converts consecutive bytes from a buffer into a long.
longToBytes
public static void longToBytes(long value,
byte[] buffer,
int offset)
- Writes a long into a buffer.
intToBytes
public static void intToBytes(int value,
byte[] buffer,
int offset)
- Writes an int into a buffer.
shortToBytes
public static void shortToBytes(short value,
byte[] buffer,
int offset)
- Writes a short into a buffer.
dump
public static void dump(java.io.PrintStream printer, byte[] buffer, int offset, int count)
- Dumps a buffer in printable form.
|
|||||||||
| Home >> All >> com >> act365 >> [ net overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.act365.net.SocketUtils