serversocket

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 and rejects it if it is not the loopback address, but I know that peer IP addresses can be s...

server socket hosting

To test a client/server networking application using socket programming, Is there a free hosting company that would allow me to open Server sockets and listen on a port? ...

Python Access to BaseRequestHandler

My code basically needs to start up a simple chat server with a client. Where the server and the client can talk back and forth to each other. I've gotten everything to be implemented correctly, but I can't figure out how to shut down the server whenever I'm done. (I know it's ss.shutdown()). I'm wanting to end right now based on a...

Java socket accept queue length

According to the Sun's documentation on ServerSocket: The maximum queue length for incoming connection indications (a request to connect) is set to 50. If a connection indication arrives when the queue is full, the connection is refused. How can I increase the the queue length? It's my server's bottle-neck. Thank you. ...

Completing a socket connection across an intranet or internet.

I am writing a peer-to-peer binary socket program. There are only two endpoints. One socket is listening on my laptop system. The other socket is broadcasting from my desktop system. I have a third program running on a hosted server, that is available to broker the connection between the two. My problem is that when the laptop and d...

Tomcat6 on Linux uses 100% CPU whenever ServerSocket is idle

Greetings I am running my webapp on Tomcat6 on Java6 on Ubuntu8.04. The main servlet of this app opens a ServerSocket, with the following simple code: ServerSocket serverSocket = new ServerSocket(6767); Socket xmlSocket = serverSocket.accept(); Of course this runs in a separate thread and with the necessary try-catch blocks....

Is it possible to for a ServerSocket object to accept a connection request in 3G?

I have been trying to setup a Droid to Droid 3G connection. I can confirm that all works great in wifi mode. The Droid can make connection requests (Http, Telnet, raw sockets) in 3G, but I cannot get the Droid to accept a socket connection in 3G mode. I am using the java.net.ServerSocket class. If anyone knows how to program the...

Get connection ID from ServerSocket

Hello. I need to get connection ID from ServerSocket. By client I send text and I need to know which client sended text. Any ideas?? ...

How to find out on which internet addresses a java program can listen.

My program needs to listen incoming socket connections (lets agree on port 8765), but it doesn't know which addresses it can bind on a particular machine. Of, course, it could simply to listen to all of them, but it need to send to the client program over a different(slower) channel the addresses which it should try in order to rich me ...

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 client process X : sends a connection request through a "Socket" to Y. Y: Then the acce...

Question regarding TCP Connection Forcefully shut down.

Hi All, I am designing a Client Server Chat application in Java which uses TCP connection between them. I am not able to figure out how to detect at server side when a client forcefully closes down. I need this as i am maintaining a list of online clients and i need to remove user from the list when he forcefully closes the connection. ...

Android: Bluetooth connection, socket and thread

Hi, I’m currently working on a Android project and is very newbie to the Android platform. It’s an exercise I got from an article where I have to create a twitterlike application so that one Android platform can write to another and it automatically is updating. I’m using a Bluetooth emulator for Android to test. But before I start wi...

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 java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import ja...

Using a Java ServerSocket for multiple Mobile Platforms?

Hello, Is it possible for me to use A Java Programme that accepts Sockets using a ServerSocket to accept Sockets from multiple mobile platforms? e.g. Can I use my ServerSocket to connect to: An Android Phone, iPhone Phone, And Blackberry phones? I am trying to make one server for all phones because the server holds multiple data types. ...

In TCP MultiThreaded Server, if a client gets service ,how to find the port number of servicing socket?

In TCP Multi Threaded Server, if a client gets service ,how to find the port number of servicing socket? From sun java tutorials When a connection is requested and successfully established, the accept method returns a new "Socket object" which is bound to the same local port and has it's remote address and remote port set to that of th...

will ServerSocket(port) and multiple threading works well for 5000 simultaneous clients hits?

hi, i am working upon serversocket class and opening threads when a new client hits the serversocket.... serverSocket = new ServerSocket(port); while (true) { Socket clientSocket = serverSocket.accept(); new Thread(this).start();//opening multiple threads } but when 5000 clients hits on this serversocket an error come...

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 says: Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 ...

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

Hi, 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. But how is it possible for a ServerSocket class to accept multiple tcp connections on...

ServerSocket blocked by thread seeking input from console

Can anyone give me insight into why the ServerSocket constructor never returns in the new thread? (I never see the "Opened" message printed to the console.) It seems the main thread prevents the server socket thread from running by entering into readLine too quickly: public class Main { public static void main(String[] args) throws I...

Java Socket Read Time Out Exception thrown only after Network comes back after being disabled at start up

I am working on a distributed application that communicates over socket connections. I'm not sure if this matters with the problem but it is a Netbeans RCP application. There are 2 different client sides of it which simply display the status of their connection to the server, send requests to the server side and display the responses r...