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

what’s the meaning of server.onDispose().block()?

There are few web pages about reactor-netty on the internet. And I don’t understand the meaning of some code below. These code below is just ABC of reactor-netty. But I really can not find more information on the internet. So I have to ask for help. Please help me with the five places in the code above. Thank you. Answer

While loop doesn’t exit after file download

I’ve got the following code to download a file being transmitted over TCP: upload code: The upload exits its loop fine. Once all the bytes have been processed (they are always processed successfully, however the loop is never exited), the file is created, without a single issue, but, the loop doesn’t exit. Answer TCP/IP connections are designed to be long-lived

Netty writeAndFlush() incomplete

My tcp client request netty server, and netty server use writeAndFlush() return 393718 bytes. But the client only receive 262142 bytes. I use “tcpdump -A” to apturing packets, less than 393718 too. So I think the properble is in netty writeAndFlush() function? Here is the code tcp server: server handler: tcp client: Answer You close the connection directly after writing,

TCP threaded server/client

I’m trying to make a threaded TCP server that accept multiple client. It’s only accepting one client. Any idea on how to make the server accepting multiple client? Here is what I tried so far: I changed the server code. I ran both the server and the client, but it seems that it’s only one thread is working. Should I

Advertisement