Skip to content
Advertisement

Tag: tcp

Socket won’t send data after blocking queue .take()

Edit: I’ve found the problem ( see answer below ) I’m trying to write an Android application to send data to a running termux instance via TCP. In termux, I have netcat listening for incoming TCP connections and printing data to stdout using the command nc -l localhost 8080. In my android app, I have a thread that reads in

Java Implementing a Client Server Model (Using TCP) and sending a IP address from server and Printing it out on Client

Server code: Client code: Error: Server side: Exception in thread “main” java.lang.NumberFormatException: For input string: “ip” at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67) at java.base/java.lang.Integer.parseInt(Integer.java:660) at java.base/java.lang.Byte.parseByte(Byte.java:193) at java.base/java.lang.Byte.parseByte(Byte.java:219) at exp1/exp1.MyServerSocket.main([MyServerSocket.java:14](https://MyServerSocket.java:1 I’m trying to display the localhost’s ip on client but I get an error. Answer getHostAddress returns a string representation of an address. So, this method returns something like 192.168.1.100 which can’t be parsed

If a peer client disconnects from a server could we just ignore the socketexception at the server side?

I have a server which accepts input from client; it reads text input from client and processes it in some way(each new connection is assigned a thread also). However, whenever a client suddenly disconnects from the server I receive a socketException(connection reset) from the server where BufferedReader.readLine() is invoked. So basically this exception is an indicator that a client was

Efficient way to extract protocol data units from tcp byte stream

I’ve had two java projects (simple multiplayer games) that relied on a byte-based connection-oriented protocol for communication. In both cases I was unhappy with the implementation of the communication, since I couldn’t come up with an intelligent, non-verbose and object-orientied way of writing and especially parsing the bytes. For writing I had something like That was acceptable to some extent,

Java TCP Client/Server

I have a problem which I do not know how to proceed further in Java TCP socket issue. So far as what we can get from the Internet, it’s not hard to get quite a number of working solution for TCP …

java.net.ConnectException: Connection refused

I’m trying to implement a TCP connection, everything works fine from the server’s side but when I run the client program (from client computer) I get the following error: I tried changing the socket number in case it was in use but to no avail, does anyone know what is causing this error & how to fix it. The Server

Advertisement