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

1869 questions
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
  • 13,182
  • 11
  • 64
  • 121
12
votes
6 answers

Connect to Android App's Socket from Internet: Possible?

I am trying to develop an Android (server) app that will accept TCP connections directly from the Internet. I tried this a couple of years ago with no joy. Is this even possible? I asked this question differently way back then, on StackOverflow…
DontPanic
  • 2,164
  • 5
  • 29
  • 56
12
votes
5 answers

Java Server - Multiple ports?

I'm about to program a server but am wondering if what I have in mind is possible. My program will be outputting to multiple clients on multiple ports - each port can be accessed by multiple clients. Normally I would use a threaded socket server,…
Myn
  • 691
  • 4
  • 9
  • 19
12
votes
3 answers

How does serversocket class serve multiple client connections on same port?

When using a Socket class one is establishing a TCP connection to a server on some port, but on the server the ServerSocket is capable of handling multiple client connections for each accept request and delegate it to a thread to server the request.…
keshav84
  • 2,291
  • 5
  • 25
  • 34
12
votes
1 answer

How can I bind serversocket to specific IP?

If I have a String representing an IP address (IPv4 or IPv6) how can I create a ServerSocket and bind to this IP without caring if the IP passed in, is IPv4 or IPv6? I see that there is a constructor:ServerSocket(int port, int backlog, InetAddress…
Jim
  • 18,826
  • 34
  • 135
  • 254
12
votes
3 answers

When cancelling the bluetooth server socket before accepting, the whole process dies. Why?

I am compiling for SDK 10 (2.3.3): android:minSdkVersion="10" android:targetSdkVersion="16" I am testing on two Sony Ericsson smartphones. One has Android 2.3.7 on it and the other 4.0.1. I am using listenUsingInsecureRfcommWithServiceRecord to…
George Pligoropoulos
  • 2,919
  • 3
  • 33
  • 65
11
votes
3 answers

Can't use ServerSocket on Android

I'm trying to listen on a port using ServerSocket on an Android device. I want to be able to connect to this port over WiFi using a computer on the same network. I get no exception when binding it to a port, however when I check netstat it…
shuwo
  • 453
  • 2
  • 6
  • 10
11
votes
3 answers

ServerSocket - Is it really necessary to close() it?

I have this damnable structure: public void run() { try { if (!portField.getText().equals("")) { String p = portField.getText(); CharSequence numbers = "0123456789"; …
Ericson Willians
  • 7,606
  • 11
  • 63
  • 114
9
votes
5 answers

How do I have a socket accept connections only from the localhost (in Java)?

I have a java app (not running in any application container) which listens on a ServerSocket for connections. I would like it to only accept connections which come from localhost. Currently, after a connection is accepted, it checks the peer IP…
sdcoder
9
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
  • 579
  • 2
  • 9
  • 26
9
votes
5 answers

Reading POST data from html form sent to serversocket

i try to write simplest possible server app in Java, displaying html form with textarea input, which after submitting gives me possibility to parse xml typed in that textarea. For now i build simple serversocket based server like that: import…
qqryq
  • 1,814
  • 3
  • 18
  • 20
8
votes
4 answers

java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer) is occuring some times

I have searched a lot for this exception, which rarelly occur, but I didn't find any relevant answer which can solve my problem, I am using HttpURLConnection to get response as a xml from a url, it works fine but sometimes i get this…
OM Yadav
  • 81
  • 1
  • 1
  • 2
8
votes
1 answer

Sending an ArrayList from the server side to the client side over TCP using socket?

I'm trying to send one object from the server side socket to the client side socket over TCP. I can't find out where is the problem. Here is the error I'm getting on the Client side: java.io.EOFException at…
Bernard
  • 4,240
  • 18
  • 55
  • 88
8
votes
2 answers

I've created a Java server with sockets, just how do print to ALL sockets?

I've been trying this for a while, and I want multiple clients to recieve multiple inputs simultaneously. There is one problem, I want the server to print "Hi" to all clients if one client says 'print2all Hi'. I know how to process it to print it,…
KeirDavis
  • 665
  • 2
  • 10
  • 32
7
votes
3 answers

Seeking tutorials and information on load-balancing between threads

I know the term "Load Balancing" can be very broad, but the subject I'm trying to explain is more specific, and I don't know the proper terminology. What I'm building is a set of Server/Client applications. The server needs to be able to handle a…
Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327