public class SocketUtils extends Object
| Constructor and Description |
|---|
SocketUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
closeServerSocket(ServerSocket serverSocket)
Closes the given ServerSocket.
|
static Object |
readObject(InetAddress inetAddress,
int port)
Reads an object from the given socket InetAddress.
|
static Object |
readObject(Socket clientSocket)
Reads an object from the given socket object.
|
static Object |
readObject(String serverName,
int port)
Reads an object from the given socket InetAddress.
|
static void |
writeObject(InetAddress inetAddress,
int port,
Object objectToSend)
Writes the given Object to the given InetAddress who listen to the given
port.
|
static void |
writeObject(Socket socket,
int port,
Object objectToSend)
Writes the given Object to the given Socket who listen to the given port.
|
static void |
writeObject(String serverName,
int port,
Object objectToSend)
Writes the given Object.
|
public static boolean closeServerSocket(ServerSocket serverSocket)
serverSocket - The ServerSocket to close.public static Object readObject(InetAddress inetAddress, int port) throws IOException, ClassNotFoundException
inetAddress - the InetAddress to read.port - The port to read.IOException - Signals that an I/O exception has occurred.ClassNotFoundException - the class not found exceptionpublic static Object readObject(Socket clientSocket) throws IOException, ClassNotFoundException
clientSocket - the socket to read.IOException - Signals that an I/O exception has occurred.ClassNotFoundException - the class not found exceptionpublic static Object readObject(String serverName, int port) throws IOException, ClassNotFoundException
serverName - The Name from the address to read.port - The port to read.IOException - Signals that an I/O exception has occurred.ClassNotFoundException - the class not found exceptionpublic static void writeObject(InetAddress inetAddress, int port, Object objectToSend) throws IOException
inetAddress - the inet addressport - The port who listen the receiver.objectToSend - The Object to send.IOException - Signals that an I/O exception has occurred.public static void writeObject(Socket socket, int port, Object objectToSend) throws IOException
socket - The Socket to the receiver.port - The port who listen the receiver.objectToSend - The Object to send.IOException - Signals that an I/O exception has occurred.public static void writeObject(String serverName, int port, Object objectToSend) throws IOException
serverName - The Name from the receiver(Server).port - The port who listen the receiver.objectToSend - The Object to send.IOException - Signals that an I/O exception has occurred.Copyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.