Questions tagged [serversocket]

ServerSocket is a java.net class that provides a system-independent implementation of the server side of a client/server socket connection.

ServerSocket is a java.net class that provides a system-independent implementation of the server side of a client/server socket connection.

A server socket's job is to set up the communication endpoint and passively wait for requests to come in over the network.

Further Reference

Related Tags

1801 questions
214
votes
20 answers

How do I resolve the "java.net.BindException: Address already in use: JVM_Bind" error?

In Eclipse, I got this error: run: [java] Error creating the server socket. [java] Oct 04, 2012 5:31:38 PM cascadas.ace.AceFactory bootstrap [java] SEVERE: Failed to create world : java.net.BindException: Address already in use:…
Caffeinated
  • 10,270
  • 37
  • 107
  • 197
43
votes
9 answers

What is the difference between Socket and ServerSocket?

If Socket represents client side and ServerSocket represents server side, why Socket.read reads the data from server side? I'm really confused, Can you please clarify it to me?
sevugarajan
  • 8,831
  • 12
  • 32
  • 30
41
votes
4 answers

Difference between TCP Listener and Socket

As far as I know I can create a server using both TCPListener and Socket, so what is the difference between the two of them? Socket private Socket MainSock; MainSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,…
Roman Ratskey
  • 4,609
  • 6
  • 40
  • 66
33
votes
3 answers

Benefits of Netty over basic ServerSocket server?

I need to create a relatively simple Java tcp/ip server and I'm having a little trouble determining if I should use something like Netty or just stick with simple ServerSocket and InputStream/OutputStream. We really just need to listen for a…
jluce50
  • 1,083
  • 3
  • 10
  • 14
28
votes
3 answers

How to read all of Inputstream in Server Socket JAVA

I am using Java.net at one of my project. and I wrote a App Server that gets inputStream from a client. But some times my (buffered)InputStream can not get all of OutputStream that client sent to my server. How can I write a wait or some thing like…
25
votes
1 answer

Creating the ServerSocket in a separate thread?

I have a problem with using a ServerSocket in my application. I'm creating the ServerSocket in the constructor of my application. The constructor of the socket calls the accept() method to wait for a client to connect. The problem is that the…
Chocolate
  • 414
  • 1
  • 5
  • 16
16
votes
3 answers

How to read TLS certificates websockets using PHP?

I am trying to connect to a secure websocket created by PHP, but for some reason it doesn't work. The certificate files are readable for PHP. This is my code so far (PHP side; stripped down code for simplicity): $context =…
alpham8
  • 1,220
  • 2
  • 12
  • 30
15
votes
12 answers

Connect two client sockets

Let's say Java has two kind of sockets: server sockets "ServerSocket" client sockets or just "Socket" Imagine the situation of two processes: X = Client Y = Server The server process Y : has a "ServerSocket", that is listening to a TCP port The…
Hernán Eche
  • 5,446
  • 11
  • 44
  • 71
14
votes
8 answers

java.net.SocketException: Invalid argument: connect

My new laptop (Alienware m17x) throws a java.net.SocketException: Invalid argument: connect when I run the following basic code: Server.java: public static void main (String[] args) throws Exception { ServerSocket serverSocket = new…
abourg28
  • 565
  • 2
  • 5
  • 10
14
votes
2 answers

Error while reading inputstream : Software caused connection abort' in java server

I am basically trying to host a server on an Android Device. Client devices connect to the server over TCP and send requests. The server performs the action requested by the client and then writes data back to the socket. The connection is not…
Umang Mathur
  • 771
  • 1
  • 6
  • 30
14
votes
4 answers

"java.net.BindException: Address already in use" when I am already running a service on the same port

I have one server socket program, when I run this program I get the following error: java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at…
user2346809
  • 141
  • 1
  • 1
  • 3
14
votes
6 answers

Why is ServerSocket.setSocketFactory static?

I'm trying to use a custom SocketImpl with SSL in Java. Because of that I need to set ServerSocket's socket factory. I now noticed that it's static, which creates some hassle for me as a I want to supply it with some paramaters that differs between…
Yrlec
  • 3,223
  • 6
  • 35
  • 72
13
votes
1 answer

Android Machine is not on the network

I am having a problem Running a network service when my app connects to a WiFi network. I am getting a the following exception, java.net.SocketException: socket failed: ENONET (Machine is not on the network) in the openPort() method…
Lonergan6275
  • 1,739
  • 5
  • 28
  • 61
13
votes
4 answers

Java ServerSocket connection limit?

I was running a few tests with sockets, and I encountered some strange behavior: A ServerSocket will refuse connections after the 50th client Socket connects to it, even if that client socket is closed before the next one is opened, and even if a…
FThompson
  • 27,043
  • 11
  • 53
  • 89
12
votes
2 answers

Android ServerSocket programming with jCIFS streaming files

I've got a bit of an issue and I've been asking regarding it quite a few times, but I think I'm one step closer now, so hopefully someone can help me with the rest. My previous questions: Connect to NAS device from Android How to open files in…
Michell Bak
  • 12,857
  • 11
  • 60
  • 121
1
2 3
99 100