¡@

Home 

java Programming Glossary: serversocket

Send message from a basic server to a specific client

http://stackoverflow.com/questions/10777678/send-message-from-a-basic-server-to-a-specific-client

it even possible in Java Ok here goes. setting up server ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client.. here goes. setting up server ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client socket to accept it Socket.. need to maintain a separate connection to each client. The ServerSocket class has an accept function which returns a Socket object...

Sending a message to all running client threads

http://stackoverflow.com/questions/13115784/sending-a-message-to-all-running-client-threads

when i am try in my code there is no method like that in ServerSocket . Okay this is my sample code for server and the thread. class.. my sample code for server and the thread. class ServerOne ServerSocket server null ... ServerOne int port System.out.println Starting.. Starting server on port port try server new ServerSocket port System.out.println Server started successfully and now..

Java: How to detect a remote side socket close?

http://stackoverflow.com/questions/151590/java-how-to-detect-a-remote-side-socket-close

main String args throws IOException InterruptedException ServerSocket ss ServerSocketFactory.getDefault .createServerSocket PORT Socket.. throws IOException InterruptedException ServerSocket ss ServerSocketFactory.getDefault .createServerSocket PORT Socket s ss.accept.. ServerSocket ss ServerSocketFactory.getDefault .createServerSocket PORT Socket s ss.accept Thread.sleep 5000 ss.close s.close public..

Why is it impossible, without attempting I/O, to detect that TCP socket was gracefully closed by peer?

http://stackoverflow.com/questions/155243/why-is-it-impossible-without-attempting-i-o-to-detect-that-tcp-socket-was-grac

identical results are obtained using NIO. import java.net.ServerSocket import java.net.Socket public class MyServer public static void.. public static void main String args throws Exception final ServerSocket ss new ServerSocket 12345 final Socket cs ss.accept System.out.println.. String args throws Exception final ServerSocket ss new ServerSocket 12345 final Socket cs ss.accept System.out.println Accepted..

How can I interrupt a ServerSocket accept() method?

http://stackoverflow.com/questions/2983835/how-can-i-interrupt-a-serversocket-accept-method

can I interrupt a ServerSocket accept method In my main thread I have a while listening loop.. I have a while listening loop which calls accept on my ServerSocket object then starts a new client thread and adds it to a Collection..

Socket using in a swing applet

http://stackoverflow.com/questions/3244400/socket-using-in-a-swing-applet

if kind Kind.Client socket new Socket HOST PORT else ServerSocket ss new ServerSocket PORT socket ss.accept in new Scanner socket.getInputStream.. socket new Socket HOST PORT else ServerSocket ss new ServerSocket PORT socket ss.accept in new Scanner socket.getInputStream..

Sockets: Discover port availability using Java

http://stackoverflow.com/questions/434718/sockets-discover-port-availability-using-java

throw new IllegalArgumentException Invalid start port port ServerSocket ss null DatagramSocket ds null try ss new ServerSocket port.. ServerSocket ss null DatagramSocket ds null try ss new ServerSocket port ss.setReuseAddress true ds new DatagramSocket port ds.setReuseAddress..

Pass String as params from one Java App to another

http://stackoverflow.com/questions/6121990/pass-string-as-params-from-one-java-app-to-another

second process queries. You could have one process open a ServerSocket and the other connect to it and send the data that way. You..

How to get Ip address of our own system using java

http://stackoverflow.com/questions/9481865/how-to-get-ip-address-of-our-own-system-using-java

as a bootstrapping node. The nodes then create their own ServerSocket and start listening for connections. The bootstrapping node.. using cli.getInetAddress once the client connects to the ServerSocket of bootstrapping node. But that didn't work. I need the client..

socket programming multiple client to one server

http://stackoverflow.com/questions/10131377/socket-programming-multiple-client-to-one-server

public static void main String args ServerSocketFactory serverSocketFactory ServerSocketFactory.getDefault ServerSocket serverSocket.. ServerSocketFactory.getDefault ServerSocket serverSocket null try serverSocket serverSocketFactory.createServerSocket.. ServerSocket serverSocket null try serverSocket serverSocketFactory.createServerSocket PORT_NUM catch IOException..

Send message from a basic server to a specific client

http://stackoverflow.com/questions/10777678/send-message-from-a-basic-server-to-a-specific-client

in Java Ok here goes. setting up server ServerSocket serverSocket new ServerSocket 8000 0 IPaddress creating a client socket to.. creating a client socket to accept it Socket clientSocket serverSocket.accept Now I accept the client in a seperate thread so that.. just do it in a loop for int i 0 i 5 i clientSocket serverSocket.accept start a new thread passing it the clientSocket as an..

Java TCP socket: data transfer is slow

http://stackoverflow.com/questions/1169739/java-tcp-socket-data-transfer-is-slow

new Thread new Runnable public void run try ServerSocket serverSocket new ServerSocket 12345 Socket clientSocket serverSocket.accept.. serverSocket new ServerSocket 12345 Socket clientSocket serverSocket.accept long startTime System.currentTimeMillis byte buffer new..

Sending a message to all running client threads

http://stackoverflow.com/questions/13115784/sending-a-message-to-all-running-client-threads

LinkedBlockingQueue Object messages private ServerSocket serverSocket public Server int port clientList new ArrayList ConnectionToClient.. ConnectionToClient messages new LinkedBlockingQueue Object serverSocket new ServerSocket port Thread accept new Thread public void.. new Thread public void run while true try Socket s serverSocket.accept clientList.add new ConnectionToClient s catch IOException..

Is it possible to change plain socket to SSLSocket?

http://stackoverflow.com/questions/6559859/is-it-possible-to-change-plain-socket-to-sslsocket

ssf ServerSocketFactory.getDefault ServerSocket serverSocket ssf.createServerSocket 12345 I've initialised an sslContext.. with a keystore as you normally would. Socket socket serverSocket.accept SSLSocketFactory sslSf sslContext.getSocketFactory The..

java.net.SocketException: Invalid argument: connect

http://stackoverflow.com/questions/8216713/java-net-socketexception-invalid-argument-connect

static void main String args throws Exception ServerSocket serverSocket new ServerSocket 8888 Socket socket serverSocket.accept Client.java.. serverSocket new ServerSocket 8888 Socket socket serverSocket.accept Client.java public static void main String args throws..

Cannot assign requested address: JVM_Bind

http://stackoverflow.com/questions/8965155/cannot-assign-requested-address-jvm-bind

args throws UnknownHostException IOException ServerSocket serverSocket serverSocket new ServerSocket 9999 I'm 100 sure that my ports.. UnknownHostException IOException ServerSocket serverSocket serverSocket new ServerSocket 9999 I'm 100 sure that my ports are forwarded.. Task Manager. If this still doesn't work replace the line serverSocket new ServerSocket 9999 With InetAddress locIP InetAddress.getByName..

Knock Knock application with server and UI

http://stackoverflow.com/questions/9240308/knock-knock-application-with-server-and-ui

void main String args throws IOException ServerSocket serverSocket null try serverSocket new ServerSocket 4444 catch IOException.. args throws IOException ServerSocket serverSocket null try serverSocket new ServerSocket 4444 catch IOException e System.err.println.. System.exit 1 Socket clientSocket null try clientSocket serverSocket.accept catch IOException e System.err.println Accept failed...

Java sending and receiving file (byte[]) over sockets

http://stackoverflow.com/questions/9520911/java-sending-and-receiving-file-byte-over-sockets

part that receives what the client sends. ServerSocket serverSocket null serverSocket new ServerSocket 4444 Socket socket null socket.. what the client sends. ServerSocket serverSocket null serverSocket new ServerSocket 4444 Socket socket null socket serverSocket.accept.. new ServerSocket 4444 Socket socket null socket serverSocket.accept DataOutputStream out new DataOutputStream new BufferedOutputStream..