The code below aims at making TCP Server and Clients. But when the number of the client threads is too big(for example: 100 threads), then client receives an “Connection reset by peer” error. I can’t find out the cause of the error, so I need your help.
#!/usr/bin/env ruby1.9 # -*- coding: utf-8 -*- require "socket" crab = TCPServer.new "127.0.0.1", 8087 while browser = crab.accept Thread.new browser do | client | puts client.gets client.puts "hello" client.close end end
#!/usr/bin/env ruby1.9 # -*- coding: utf-8 -*- require "socket" threads_arr =  ARGV.to_i.times do t = Thread.new do client = TCPSocket.new "127.0.0.1", 8087 client.puts "hello" client.gets client.close end threads_arr << t end threads_arr.each do | t | t.join end
Mac OS X 10.6.8
ruby 1.8.7p174 / ruby 1.9.2p180
Connection reset by peer socket write error
Hi i am trying to send one big buffer in multiple packets to client machine but after 4-5 write calls i get error Connection reset by peer socket write error. Below is my code sample server.c int ma
How to solve “Connection reset by peer: socket write error”?
When I am reading the file content from server it returns the following error message. Caused by: java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream
Connection Reset by Peer Error
I am getting the following exception [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer: socket write error Its happening on the application server when the web app tries to access
MRJob: socket.error: [Errno 104] Connection reset by peer
In short: socket.error: [Errno 104] Connection reset by peer exception while using MRJob. The script actually has access to S3 because it does create buckets and uploads some small files (I’ve check
mongodb Connection reset by peer : socket writer error
I am receiving the error below sometimes during update mongodb 2012-03-06 00:09:39,733 SEVERE [com.mongodb.tcp] (http-0.0.0.0-80-169) MyPort.error called java.net.SocketException: Connection reset
java.net.SocketException: Connection reset by peer: socket write error [closed]
java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(Unknown Source) at java.net
Connection reset by peer: socket write error
I am getting an exception on OutputStream.write in the last while loop (it works fine on other places in the code) when running this code- this is an implantation of a proxy-server in java, when searc
git clone error. Read from socket failed: Connection reset by peer fatal: Could not read from remote repository
While try to clone project from Mooveb getting below error. $ git clone [email protected]:skoteeswaran/ving-test.git Cloning into ‘ving-test’… Read from socket failed: Connection reset by peer
What does “connection reset by peer” mean?
What is the meaning of the connection reset by peer error on a TCP connection? Is it a fatal error or just a notification?
Error Handling: Boto: [Error 104] Connection Reset by Peer
I have a script that downloads from Amazon S3. The scripts works 99.9% of the time. Occasionally I get the following error (socket.error: [Errno 104] Connection reset by peer). Once I restart the code
Would this be easier to do in EventMachine? Threading will only scale so far before it starts to cause trouble. EventMachine also handles load better when receiving a large number of connections.
You may need to check that your accept queue is sufficiently large. The default is something like 5 pending connections and if they can’t be acknowledged quickly enough you might have them dropped.
Socket connection should be closed on one side – or client only or server only. In your example if server close connection first client receive exception when try close connection.
Delete for example close call in client:
t = Thread.new do client = TCPSocket.new "127.0.0.1", 8087 client.puts "hello" client.gets end