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
6
votes
2 answers

Usage of getaddrinfo() with AI_PASSIVE

The getaddrinfo() function not only allows for client programs to efficiently find the correct data for creating a socket to a given host, it also allows for servers to bind to the correct socket - in theory. I just learned about that and started to…
glglgl
  • 81,640
  • 11
  • 130
  • 202
6
votes
4 answers

How to close port after using server sockets

In my application I create a ServerSocket instance with some port. After I am finished, I close the socket, but when I try to make a new ServerSocket on the same port, it throws: "java.net.BindException: Address already in use" If I create the…
dan
  • 149
  • 2
  • 2
  • 5
6
votes
3 answers

Unsecured Bluetooth connection in Android

I have been challenged by a professor to develop a little Bluetooth Demo app on Android. I knew nothing about developping for Android until 2 weeks ago when he gave me that challenge. I'm also quite new at Java programming in general, so I'm…
AntoineG
  • 1,217
  • 2
  • 15
  • 24
6
votes
1 answer

Android Bluetooth Server socket will be blocked on accept() if it processes more than one conntion

I have studied the android bluetooth example. What I'm confused is that other devices has sent a connection request, and the server is just blocked so long without accepted if previous connection exsited. Is it possible for an android device which…
Fiona
  • 61
  • 1
  • 2
6
votes
1 answer

If I close a ServerSocket, will the Sockets accepted by the ServerSocket be also closed?

ServerSocket serverSocket = new ServerSocket(some_port); Socket socket = serverSocket.accept(); serverSocket.close(); Will socket be closed as well?
hebothu
  • 249
  • 1
  • 9
6
votes
2 answers

Synchronize time between client/server java sockets

Here, I am developing a project with java sockets and I have a problem with the implementation of the correct time synchronization between Server and Client. I am going to describe the problem with a simple example: Server runs on GMT and keeps a…
javasuns
  • 905
  • 1
  • 8
  • 22
6
votes
2 answers

java.util.Scanner hangs on hasNext()

I'm encountering a very strange issue with the Scanner class. I'm using Scanner to read messages from a Socket with a special EOF token. Everything works fine if the client writes all requests at once, or the requests have data, but the blocking…
Jake Holzinger
  • 4,610
  • 1
  • 14
  • 30
6
votes
1 answer

Socket.Shutdown throws SocketException

I'm trying to implement async sockets for my project. Here's the code public void Start(int listeningPort) { var ipHostInfo = Dns.Resolve(Dns.GetHostName()); var ipAddress = ipHostInfo.AddressList[0]; var…
Davita
  • 8,246
  • 12
  • 56
  • 113
6
votes
1 answer

Listen for incoming connections in AS3 (AIR) Client whithout using Server Socket

I managed to create a C# Server that sends files to AS3(AIR) Clients using sockets. On the AS3 side I'm using the flash.net.Socket library to receive the data through TCP. This is how it works: -> I turn on my server, and it listens for clients…
Schrödinger's Box
  • 3,038
  • 1
  • 27
  • 50
5
votes
1 answer

ServerSocket not accepting on droid emulator

I'm trying to set up a basic network connection using the droid emulators with eclipse but I'm having problems. The server reaches the line "Socket s = ss.accept();" and waits for the client to connect, but the client can't seem to connect. Now…
Travis Frazier
  • 412
  • 3
  • 13
5
votes
2 answers

Transfer a file between Android devices?

I'm making a code and I want to send a mp4 file to another Android device. I have reached to connect both Androids via Wifi and write from one a simple for cycle from 1-20 and the other Android device reads and displays the number that is sent. Here…
Merol
  • 275
  • 5
  • 12
5
votes
1 answer

WebFlux + RSocket + Spring

Can someone tell me or give a ready-made CRUD example using WebFlux, RScoket and Spring (or SpringBoot)? I studied the RSocket documentation, WebFlux, also wrote my simple examples, but I would like to see a real CRUD application using basic methods…
5
votes
1 answer

How can I set a timeout for a blocking call?

I have a multi-threaded chat server working with multiple clients (each client is being handled in a new thread). If a client disconnects, the relevant thread on the server hangs on inputstream.readLine() which is a blocking call. How can I set some…
Gimme the 411
  • 628
  • 4
  • 21
5
votes
1 answer

bind: Socket operation on non-socket

I writing a server and a client and keep getting 'bind: Socket operation on non-socket'. I've researched the heck out of this, have other code that runs in another application and have exhausted 8 hours trying to find this bug. The code is: void…
Ted Spradley
  • 3,274
  • 3
  • 19
  • 23
5
votes
0 answers

How to create a secured TCP connection via TLS v.1.2 in Java

I want to create commnicate between two systems via TLS v1.2. The information it contains is confidential. I want to avoid an https web service call and diectly want to perform message exchange at the TCP layer. Can you suggest how to implement this…
Argho Chatterjee
  • 400
  • 1
  • 6
  • 20