serversocket

Socket InputStream on windows blocks and swaps queries

倾然丶 夕夏残阳落幕 提交于 2019-12-11 15:18:33
问题 I'm writing a simple ServerSocket program and connecting to it from two browser tabs by urls: http://127.0.0.1:8080/Q1 and after a 10 sec pause http://127.0.0.1:8080/Q2. My problem is that on ubuntu18 machine with java10 it works quick and fine. But on two win machines (my win8.1 with java8 and other win10 with java11) it hangs up after first query and does nothing for up to 2 minutes, server stays quiet if I don't send second query. If I send second query I get result for both queries (in

How to keep client and server talking

一世执手 提交于 2019-12-11 12:40:07
问题 I am trying to build my own asynchronous client/server app using .net sockets. Using these two examples, the basic functionality works. Server Client This example sends a string to the server upon connection, and the server replies, echoing the string that it received, back to the client. After this reply, the client then shuts down. // Release the socket. client.Shutdown(SocketShutdown.Both); client.Close(); In my scenario, I am trying to connect to the server and then send data to the

trouble connecting to ServerSocket over the internet

强颜欢笑 提交于 2019-12-11 11:30:40
问题 hello guys I've created a simple chat room app but I can't connect to server to send and receive data, here is part of my code: server side: import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.util.regex.Pattern; public class Listener { public static void start() { try { final ServerSocketChannel serverSocketChannel = ServerSocketChannel.open(); serverSocketChannel.configureBlocking(true

Adobe AIR desktop application communicate with Processing application

☆樱花仙子☆ 提交于 2019-12-11 11:22:59
问题 I have a Processing application that must talk to a desktop Adobe AIR application. Can anyone suggest the best options considering the following? If sockets are the answer, which type of Socket, UDP(Datagram Class), ServerSocket or just plain Socket? -both apps reside on same machine -latency important, smaller better -signals being sent are small, consisting of 3 values -communication is 1 way only, processing TO Adobe AIR 回答1: On the Processing side you can use oscP5: import oscP5.*; import

How to use readObject() twice in socket of Java?

折月煮酒 提交于 2019-12-11 09:53:14
问题 I used the ObjectStream in Socket to transport the class. The client transports two different data in same class, but the server gets the second data that is same as the first data. It is strange! Here is my code of client: public Client() { MessageClass messageobject=new MessageClass("login"); messageobject.SetLoginUserInfo("18580409","12345","magicgiant"); try { client=new Socket("localhost",1234); System.out.println("Connected!"); ObjectOutputStream out=new ObjectOutputStream(client

IPV6 ServerSocket is still listening even after application crash

北城以北 提交于 2019-12-11 06:58:30
问题 I created a ServerSocket using: InetSocketAddress inetsktaddr = new InetSocketAddress(0); ServerSocket sckt = new ServerSocket(); sckt.bind(inetsktaddr); Socket socket = sckt.accept(); when the application is running, using netstat i found, TCP 0.0.0.0:49906 0.0.0.0:0 LISTENING 9196 TCP [::]:49906 [::]:0 LISTENING 9196 SOMETIMES WHEN THE APPLICATION CRASHES, netstat result says: TCP [::]:49906 [::]:0 LISTENING 9196 when searched for the process id 9196, no such process exists. It was the java

Java: HashMap.get returns null

独自空忆成欢 提交于 2019-12-11 06:44:24
问题 I am programming a socket server in Java for an MMORPG in AS3. I have some problems with strange behaviour of HashMap.get(byte[]). What things could cause the following problem? I don't use any serialization system, I send bytes and both client and server knows what to do with what bytes of the received bytes. The first request the client makes is asking the server to create a playing session. The server will generate a random session token as byte[] with 8 entries and adds the token to the

Full-duplex server socket implementaion, seperate read and write thread?

廉价感情. 提交于 2019-12-11 05:24:57
问题 I want to read and write(randomly from server to client) on same server socket (java application). My client to server write and read work fine in a loop. At server with response write properly. But if i am trying to write at server randomly some command. i do not have solution, first of all my question is : is it possible at server side to write command to client ramdonly on same socket? if possible, any suggestion or pointer how to do it? please give me some pointer where I can read the

ServerSocket blocked by thread seeking input from console

*爱你&永不变心* 提交于 2019-12-11 01:25:20
问题 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 IOException { new Thread(new SocketOpener()).start(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String inLine = br.readLine();

Java 7 doesn't throw BindException when binding an already used port using ServerSocket

家住魔仙堡 提交于 2019-12-10 23:56:24
问题 I'm experimenting on ServerSocket in Java on Windows 7 x64. I wrote a little program that host a HTTP server on port 8080 and only returns a static HTML response that contains the toString() of the class loader. What I did in the program mainly: Create a ServerSocket call setReuseAddress(false) on the serverSocket Bind port 8080 to this socket Use a forever loop to accept socket and give response First I tried with JRE 1.6.0_23 and everything is great: first instance launched and responds