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.

129
votes
16answers
403k views

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 : ...
21
votes
3answers
80k views

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 ...
11
votes
2answers
11k views

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 ...
14
votes
8answers
35k views

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 ...
19
votes
1answer
32k views

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 ...
12
votes
12answers
33k views

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=ClientY=ServerThe server process Y : has a "...
3
votes
1answer
5k views

Send message from a basic server to a specific client

I have two wifi modules M1 and M2 that connect to my access point. I have an android phone that connects to the same access point. I have a socket server on my android phone and the two modules join ...
11
votes
5answers
25k views

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....
6
votes
5answers
19k views

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 ...
10
votes
4answers
29k views

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 ...
2
votes
2answers
39k views

how do i connect to the server socket using the ip address and port number( client is running on a different machine than server)

Client program public class client implements Runnable {protected static String server_IP="141.117.57.42";private static final int server_Port=5555 ;protected static String client_IP ;...
2
votes
2answers
17k views

How to make GUI Client to upload file in java

Please help me I want to make a GUI application which upload a file from client to server.when I click on browse button then file is copy in bytes form because we travel data in bytes on network but ...
0
votes
1answer
5k views

Knock Knock application with server and UI

I am creating a simple Knock Knock application (socket programming) where there is a localhost server and there is a client.the program is simple, the server will tell the knock knock jokes, this is ...
0
votes
1answer
5k views

Error message: “Bitmap Image is not valid” on received from Socket

I'm trying to get a screenshot and send it over the web using ClientSocket and ServerSocket components.I'm having problems when I try to turn the stream received at ServerSocket into a picture again....
-1
votes
2answers
499 views

Server-Client chat program

I am writing a server-client chat program. Here is my code SERVER:import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.net.ServerSocket;import java....
3
votes
2answers
5k views

Wi-Fi Direct Android

I want to transfer files between 2 devices via Wi-Fi Direct. I wanted to do the same thing as in WifiDirectDemo, but I can't transfer data from the group owner to the other device, so I tried this: ...
23
votes
4answers
38k views

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?Socketprivate Socket MainSock;MainSock=new Socket(AddressFamily....
5
votes
1answer
16k views

How to create a bluetooth server socket in android?

I am trying to create a server program that just starts bluetooth, creates a server socket, waits for some device to connect and accepts the connection.The onClick() method starts the bluetooth, ...
12
votes
3answers
13k views

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 ...
-1
votes
1answer
166 views

Java socket EOFException

I use RMI and socket to transfer files between a client set. The problem is when running the code below sometimes i get this exception in client side :java.io.EOFExceptionat java.io....
6
votes
2answers
7k views

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 ...
5
votes
4answers
14k views

How to close port after using server sockets [closed]

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....
4
votes
3answers
3k views

Java the difference of Socket and ServerSocket in using port

At the server side, we use Socket server=serverSocket.accept();to create a socket. After the socket is created, we can create a new thread to handle the input/output stream of that socket. So we ...
2
votes
2answers
4k views

Writing messages to client socket using DataOutputStream to Server Socket only sent after closing the Client Socket why?

I had a Socket-Client programming in Java . I am using DataOutputStream to send messages to the Server Socket . Sometimes writed messages on DataOutputstream was not sent to the ServerSocket . I think ...
1
vote
2answers
1k views

How would an MMO deal with calculating and sending packets for thousands of players every tick for a live action game?

I am working on a game and I am thinking about getting into networking. I have been programming for about 5 years and got into game development the last 2 years. I only really learn online and from ...
0
votes
0answers
388 views

Broadcasting packet to client not working in java

I have multiple transmitters configured to send back a response when they receive a broadcast packet sent from a server through local port 5255, remote port 5252 containing the string "AST show me\0" (...
0
votes
3answers
465 views

how to write bytes to server socket

I'm writing a java socket program to read data from server, I've no control to server, below is protocol agreed, 2-bytes: magic number 2-bytes: data lengthN-bytes: ASCII string data payloadBig ...
0
votes
2answers
126 views

Application hangs when attempting to retrieve text from an inputstream

SituationI've been creating a program to exchange messages between two computers in the LAN. One computer identifies itself as the server while the other is a client. Upon startup, the user has to ...
0
votes
1answer
1k views

When hitting a JButton to connect to a server , the program freezes

I am making a simple 1v1 "private chat" using TCP in java. Currently, i have a problem whenever i am using JButtons. This is my first attempt at using JButtons and ActionListeners so i'm not 100% sure ...
-2
votes
1answer
528 views

Android web server not supported by firefox

I have created a webserver in Android which binds to port 2090 and serves the sdcard of Android devices it works fine if I type the ip:port/index.htm in Internet Explorer then it works just great but ...
3
votes
4answers
8k views

How to recive more than 65000 bytes in C++ socket using recv()

I am developing a client server application (TCP) in Linux using C++. I want to send more than 65,000 bytes at the same time. In TCP, the maximum packet size is 65,535 bytes only.How can I send the ...
29
votes
9answers
42k views

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?
7
votes
1answer
25k views

Sending an ArrayList<String> from the server side to the client side over TCP using socket? [closed]

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....
5
votes
3answers
7k views

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 ...
4
votes
1answer
7k views

Android Bluetooth: java.io.IOException: Service discovery failed

I'm trying to develop an Android application which transfers images from one device to another. The received image would then be shown on the ImageView inside my application. To achieve my task, I ...
6
votes
1answer
7k views

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:-> ...
5
votes
1answer
17k views

ServerSocket + client Socket - how do I get IP address of client?

I have a ServerSocket instance which is listening for connections. When a client connects to it, I would like to get the IP of the connected socket, but can't seem to find the right method to do so....
5
votes
2answers
4k views

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 ...
3
votes
4answers
13k views

Server socket file transfer

I have used server socket concept in java to transfer files like images and videos. But when i receive at the client side, i am customizing the file names. Can i get the original name of the file as ...
2
votes
3answers
20k views

get data from client in server socket java

I am creating a server app which does the following taskAccept connection from clientProcess each client connection to separate threadReceive data from clientsend data to clientI am able to ...
2
votes
2answers
2k views

ServerSocket listens without accept()

I'm currently involved in a project at school in which we are building a communication system to be used on Android phones. For this, we will be using a server which opens sockets towards all clients, ...
1
vote
1answer
4k views

How do I Send Data to All Threaded Clients in Java?

I am fairly new to Java, and I am trying to construct a very basic Java Relay server that sends messages from clients to all connected clients. I have figured out how to do threading to allow multiple ...
0
votes
3answers
11k views

DataInputStream giving java.io.EOFException

I have created small CLI client-server application. Once the server is loaded the client can connect to it and send commands to the server.The first command is to get list of files that server is ...
-1
votes
2answers
6k views

ServerSocket Android

Hey community I have the following ServerSocket which should listen to port 53000 and log any received data. However, I cannot seem to get past the server.accept() blocking call.public void run() {...
9
votes
3answers
18k views

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();...
7
votes
1answer
1k views

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 ...
7
votes
2answers
9k views

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 '...
4
votes
1answer
2k views

Java Socket/Serversocket WAN Connection

Im trying to make a server out of my computer so that clients from their computers can connect and communicate with my computer. I made the server on port 31350 and the client is trying to connect ...
3
votes
2answers
16k views

Java Server Socket Response

I'm trying to create a simple client/server socket communication application (chat client). I've spent countless hours looking on how to fix this with still no luck, I can send the message to the ...
3
votes
1answer
1k views

What can cause “ IO error java.net.SocketException: select failed ”?

I have a server program running on my laptop, same router and same code. It work's fine and clients can connect. However when I copied the workspace to my PC and when I run it, I get this nonsense:...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,