serversocket

TCP Socket is not stopping receiving data in C# program

▼魔方 西西 提交于 2020-03-19 06:24:09
问题 A Java Android App from an Android 2.2 phone, is sending string data to the C# program. The C# program receiving the data and showing it correctly for the first time only . Then it is not stopping receiving data. But since there is not data, it is showing as 0 as received data, while debugging and not receiving data which is sent second time by the Java App. First I thought, may be Java app is sending data continuously. But C# program is receiving data even though the Java App has closed.

Chat Server: Print chat history java

本秂侑毒 提交于 2020-02-08 09:38:44
问题 The problem is that I need to show chat history on the client side without transferring the chat file. The server and the client are on the same machine ie my pc. The server reads char by char from file and writes it on the socket. The client needs to read it as string to get exact chat history as saved in file. But by my method it is printing single char in single line import java.io.*; class Server { public static void main(String dt[]) { ServerSocket sskt=null;Socket skt=null;

Chat Server: Print chat history java

China☆狼群 提交于 2020-02-08 09:37:10
问题 The problem is that I need to show chat history on the client side without transferring the chat file. The server and the client are on the same machine ie my pc. The server reads char by char from file and writes it on the socket. The client needs to read it as string to get exact chat history as saved in file. But by my method it is printing single char in single line import java.io.*; class Server { public static void main(String dt[]) { ServerSocket sskt=null;Socket skt=null;

Server/Multiclient program wont send message to all clients

别等时光非礼了梦想. 提交于 2020-02-06 15:52:30
问题 I'm working on a program involving a multithreaded server, in which I want messages sent by clients to be echoed back to every client currently connected to the server. It doesn't exactly do this. I will send a message from a client to the server, and it will echo back to that same client. Not to the other client. Let's say, with one client I sequentially type "One" then "Two" then "Three". The exchange will be something like this: Client 1: "One" Echo from Server ON Client 1's console: "One"

What happens on closing ServerSocket

試著忘記壹切 提交于 2020-01-30 12:40:27
问题 What happens to client Sockets when I close a ServerSocket? Will all connections made with serverSocket.accept() be closed as well? 回答1: Closing a ServerSocket will prevent new connections from being created, but it won't shut down existing connections. ServerSocket is the listening socket involved only in creating a connection. The data communication is handled distinctly in the Socket returned by ServerSocket.accept(); . 来源: https://stackoverflow.com/questions/36979335/what-happens-on

Is it possible to create multiple (SSL) ServerSocket on the same port? [closed]

馋奶兔 提交于 2020-01-24 00:56:07
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 months ago . public class ServerThread implements Runnable { private static final int port = 10000; @Override public void run() { ServerSocket serverSocket = new ServerSocket(port); while (true) { Socket clientSocket = serverSocket.accept(); ClientThread clientThread = new ClientThread

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

随声附和 提交于 2020-01-22 15:25:12
问题 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 thought to send a byte array of the bitmap. I'm able to get the first image on the imageview. But, as soon as I click on the button to send another image the application fails to send the bitmap. It shows me an exception "java.io.IOException: Service fiscovery failed." To send any image successfully

Why does my client Socket not connect to my ServerSocket?

别来无恙 提交于 2020-01-16 04:34:07
问题 In this extremely basic client/server socket program, why does my client socket never connect and throw java.net.ConnectException ? I am running the MessageServer program on one computer, and the ClientServer program on another laptop on the same network. I have verified that the local-ip of the computer which is running the server program is 10.0.0.1 using the ipconfig command in the windows cmd on that computer. Server: package server; import java.net.*; import java.io.*; public class

Server can't sent message to client

社会主义新天地 提交于 2020-01-05 10:40:06
问题 I want to create an app in which server and client communicate each other. here the code... Server Side: public class MainActivity extends ActionBarActivity { private ServerSocket serverSocket; Handler updateConversationHandler; Thread serverThread = null; Socket clientSocket; private TextView text; EditText edit; Button b; public static final int SERVERPORT = 6000; String TimeStamp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView

java server: start a new thread for each received packet?

倖福魔咒の 提交于 2020-01-04 03:38:05
问题 I am currently learning how to program a tcp server in java. I am creating a new thread for new each client connection (multithreaded server). After the client connects to the server, I want to send data from the client to the server. On serverside the server is in a while loop reading data from the sockets inputstream. I want to ask now: Should I create a new thread for each received packet? For example the client sends the string "Hello". Should the server handle this packet in a new thread