Questions tagged [tcpsocket]
246 questions
47
votes
3 answers
How to disconnect from tcp socket in NodeJs
I connect to socket server in NodeJs using this command:
client = net.createConnection()
How can I then properly disconnect from the server?
I tried client.end() and even client.destroy()
but when I check the connection status using netstat it…

mgamer
- 13,580
- 25
- 87
- 145
7
votes
2 answers
receiving variable size of data over TCP sockets
I ran into a little issue with transferring data over (TCP) sockets. Small background on what I am doing:
I am sending data from side A to B. Data sent can be of variable lengths, assuming max size to be of 1096 bytes.
A) send(clientFd, buffer,…

brainydexter
- 19,826
- 28
- 77
- 115
6
votes
2 answers
Possible for WebSocket client on browser to talk to TCP Socket server?
Is it possible to have a TCP Socket server running which accepts incoming connections from WebSocket clients? I have a TCP Socket server and I'd like to be able to test this in a browser. Is this possible?

jaffa
- 26,770
- 50
- 178
- 289
5
votes
1 answer
is there a Dart Equivalent of the following Aes Encryption function in java
I have set up a server that is listening for an encrypted byte array through the java function mentioned below. Earlier i was using java (android) to build my app so it was easy using the same java function but i am unable to figure out what is the…

Vaibhav Dikha
- 53
- 1
- 7
5
votes
1 answer
Ruby TCPSocket: Find out how much data is available
Is there a way to find out how many bytes of data is available on an TCPSocket in Ruby? I.e. how many bytes can be ready without blocking?

panzi
- 7,517
- 5
- 42
- 54
5
votes
1 answer
Ruby: 4-bytes array to int32
There are 4 bytes read from TCPSocket (actually socket returns a string and then I call .bytes to get an array). Now they need to be converted to int32 big endian.
Or may be TCPSocket has some method to read int32 immediately?

Paul
- 25,812
- 38
- 124
- 247
5
votes
1 answer
Load balancer scalability and max #tcp ports
A load balancer will have some limit on how many tcp ports it can simultaneously use based on the platform it's running on (e.g. I read somewhere that Linux can have max 65535 tcp ports open simultaneously). This means that the balancer becomes a…

shrini1000
- 7,038
- 12
- 59
- 99
4
votes
0 answers
WebSocket vs. WebRTC server performance at large scale (1 million connections)
I saw this question about WebSocket performance. The conclusion of this question was that:
On today's systems, handling 1 million concurrent TCP connections is not an issue.
We had to demonstrate several times, to some of our customers, that 1…

Moshe Simantov
- 3,937
- 2
- 25
- 35
4
votes
1 answer
List of exceptions in socket python
What are the exceptions which generates while using functions of socket lib in Python language.
I have list of exception errors, but dont know which error are for socket function. https://docs.python.org/2/library/errno.html
I want to handle every…

sumit dhyani
- 53
- 2
- 11
4
votes
3 answers
Ruby TCPServer sockets
Maybe I've gotten my sockets programming way mixed up, but shouldn't something like this work?
srv = TCPServer.open(3333)
client = srv.accept
data = ""
while (tmp = client.recv(10))
data += tmp
end
I've tried pretty much every other method of…

Markus Orrelly
- 1,669
- 2
- 12
- 9
4
votes
1 answer
How to TCPServer receive data from http request in Ruby?
It's handy to send server response to the client by
server = TCPServer.open 1234
socket = server.accept
socket.puts 'data from server side'
and in the client side, curl in this case
curl -v localhost:1234
* Trying 127.0.0.1... connected
*…

mko
- 21,334
- 49
- 130
- 191
3
votes
1 answer
Ruby TCPServer sockets shared between threads
I am currently implementing a simplistic pub/sub system in ruby using only the standard lib, where a client can subscribe to a topic for messages or publish messages to a topic, which will be sent to all subscribers. I'm using just standard…

Nick Hyland
- 357
- 1
- 10
3
votes
1 answer
How to check if the tcp socket is still connected in Flutter?
I have connected to my server as follows:
Socket socket = await Socket.connect('xxx', xxx)
But now I want to check if the socket is still connected. It would be even better if I have a listener that tells me when the connection is broken.
Thanks…

LeonardvV
- 53
- 5
3
votes
1 answer
stream closed (IOError) when closing Ruby TCPSocket client
I've got a Ruby TCPSocket client that works great except when I'm trying to close it. When I call the disconnect method in my code below, I get this error:
./smartlinc.rb:70:in `start_listen': stream closed (IOError)
from ./smartlinc.rb:132:in…

Scott
- 1,164
- 2
- 14
- 24
3
votes
1 answer
How do I set TCPSocket attributes for only a method and not globally?
I'm using Rails 4.2.7 with Ruby 2.3.0. I have this code for getting a web page through a SOCKS Proxy
require "resolv-replace.rb"
require 'open-uri'
require 'uri'
require "socksify"
require 'socksify/http'
...
def…

Dave
- 15,639
- 133
- 442
- 830