Questions tagged [tcpsocket]

246 questions
3
votes
0 answers

Connection reset (SocketException)

I have this message in my console: [15:06:59] [Thread-65394/WARN]: java.net.SocketException: Connection reset [15:06:59] [Thread-65394/WARN]: at java.net.SocketInputStream.read(SocketInputStream.java:209) [15:06:59] [Thread-65394/WARN]: at…
Jules420
  • 71
  • 7
3
votes
2 answers

close tcp socket when the program was stopped by kill command

I developed an application which contains a small http server. my application is launched in the boot. if the application is stopped normally (etc/init.d/myappli stop) the socket will be closed close (socket_desc); but if I kill it with kill -9…
Anis_Stack
  • 3,306
  • 4
  • 30
  • 53
3
votes
1 answer

Python multiple file transfer over TCP sockets

I am trying to write a program in python to transfer multiple files in a folder over a socket, I have the following code so far Client: def uploadFiles(folder,dcip,PORT,filetype): os.chdir(folder) dirList = os.listdir(folder) print…
srnvs
  • 997
  • 2
  • 10
  • 22
3
votes
1 answer

Java TCP Server send more messages in one flush

using this code: Java Server side: ... out = new PrintWriter(this.client.getOutputStream(), true); ... public void sendMsg(String msg) { out.println(msg); //out.flush(); // we don't flush manually because there is auto flush true } C#…
Emrah Mehmedov
  • 1,492
  • 13
  • 28
3
votes
1 answer

Test Ruby TCPSocket server

I have a small application, serving connections(like a chat). It catches the connection, grabs login from it, then listens to the data and broadcasts it to each connection, except sender. The problem is i'm not a very advanced tester and do not…
sadfuzzy
  • 442
  • 5
  • 20
2
votes
1 answer

Whats faster sending multiple small messages or less longer messages with TCP Sockets

I can find any documentatin anywhere and would like to know what would be the best method of send multiple messages as fast as possible. for example if I had 300 devices recieivng messages from one server would it be better to send out one big…
2
votes
0 answers

Speeding up IPC with Ruby

I am trying to do IPC between 2 processes on the same Linux box in Ruby, and I need to optimize the solution as far as practicable. I had begun with a TCPSocket but I see that using UNIXSocket is probably faster, and perhaps does not copy data to…
Fanatic23
  • 3,378
  • 2
  • 28
  • 51
2
votes
2 answers

Ruby TCPSocket / HTTP request

I just started with TCPSockets. I am simply trying to get the google home page. This is my code: require 'socket' host = 'http://www.google.com' port = 80 s = TCPSocket.open host, port s.puts "GET / HTTP/1.1\r\n" s.puts "Host: Firefox" s.puts…
0xSina
  • 20,973
  • 34
  • 136
  • 253
2
votes
1 answer

What's a reliable way to verify that a socket is open?

I'm developing a C# application, working with TCP sockets. While debugging, I arrive in this piece of source code: if ((_socket!= null) && (_socket.Connected)) { Debug.WriteLine($"..."); <= my breakpoint is here. return true; } In my…
Dominique
  • 16,450
  • 15
  • 56
  • 112
2
votes
1 answer

Write to existing tcp socket over telnet/ssh in Go on Windows

I am attempting to write/print text to the screen from a Go program launched from another console/terminal application--a "door" program that launches from an old-school Bulletin Board System (BBS). The BBS itself runs over a telnet connection,…
Robbie
  • 447
  • 1
  • 6
  • 19
2
votes
1 answer

How to make sure a TCP socket connects at creation time

I have a client application that sends TCP packets. Currently, my application does this: creates a socket, binds and sends the packets. struct sockaddr_in localaddress; localaddress.sin_port = htons(0); localaddress.sin_addr.s_addr =…
user775614
  • 237
  • 3
  • 7
2
votes
1 answer

ConscryptEngine data read issue : Unable to parse TLS packet header

Below i the code for unwrap the data packets received from sslengine : private ByteBuffer doUnwrap() throws IOException { if (mPeerNetData.position() == 0) { // The network input buffer is empty; read data from the channel before…
Ashok Kumar
  • 1,226
  • 1
  • 10
  • 14
2
votes
1 answer

ruby 'async/io' and Reactor, help understand the example

I need some help in understanding basic 'async/io' example as given here: require 'async/io' def echo_server(endpoint) Async::Reactor.run do |task| # This is a synchronous block within the current task: endpoint.accept do…
Clergyman
  • 281
  • 1
  • 3
  • 13
2
votes
5 answers

How to close a Java's socket's outputstream while keeping the inputstream open to get a result?

I'm sending a message to a server, which passes correctly. But, when trying to read the result, I get an exception that the Socket is closed. Any idea how to close the socket's outputstream while keeping the socket and socket's inputstream open to…
AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
2
votes
2 answers

c# TCP socket stops receiving packet

i have a problem : My model is 1 Server serving lots Clients at the same time using TCP socket model. Codes usually work fine and never throw any exception, but sometime a connection between Server and a Client gose like this : +)Client sends…
1
2
3
16 17