Questions tagged [tcpsocket]
246 questions
0
votes
0 answers
Ruby TCPSocket - No connection could be made because the target machine actively refused it
Can't make TCPSocket connect to TCPServer:
Client
require 'socket'
require 'io/console'
TCPSocket.open('127.0.0.1', '2000') { |socket|
#socket.puts('abcdefghijklmn')
puts socket.read
}
Server
require 'socket' # Get sockets…

Paul
- 25,812
- 38
- 124
- 247
0
votes
1 answer
Persistent TCPSocket and Ruby threads
I am connecting to a server as a client using TCPSocket. The main point is to keep connection open and send there or receive from there messages as soon as they arrive.
There are no problems with sending messages, but doing socket.recv(n) in main…

Paul
- 25,812
- 38
- 124
- 247
0
votes
1 answer
Keeping TCPSocket open: server or client's responsibility?
I have been reading examples online about Ruby's TCPSocket and TCPServer, but I still don't know and can't find what's the best practice for this. If you have a running TCPServer, and you want to keep the socket open across multiple…

garbagecollector
- 3,731
- 5
- 32
- 44
0
votes
2 answers
XMPPFramework does not send keep alive in background even with enableBackgroundingOnSocket set to TRUE
I think the title is illustrating enough. I want XMPPFramework to work ( like a service ) in background and receive messages even when app is not in active state. I have set
xmppStream.enableBackgroundingOnSocket = YES;
But no progress here.
The app…

Sepehrom
- 1,335
- 2
- 16
- 33
0
votes
2 answers
Send more than 32768 Bytes at once from one TCP-Socket to an other
Hey guys, I don't know if this question has been asked yet but imagine following situation:
I have two TCP-Sockets (opened with NSSocketPort und listening with two NSFileHandle) and now I want to send some NSData between them.
@try {
[fileHandle…

papr
- 4,717
- 5
- 30
- 38
0
votes
1 answer
How do I limit the bandwidth when transferring a file with Ruby sockets
I'm developing a Windows daemon to sit on an office full of machines and respond to requests with the required information.
It needs to be able to send zipped log files back to the sender. These log files don't get much bigger than ~3MB but it's…

JoshM
- 110
- 1
- 6
0
votes
1 answer
Ruby TCPSocket recv blocking and never returning
So, I have the following code:
def LSCPHandler.send_message(message, hostname, port)
s = TCPSocket.open(hostname, port)
s.print message
ret = s.recv(1024)
s.close
LSCPHandler.parse_error(ret)
return ret
end
Which works just fine, normally. The…

J.R.
- 5,789
- 11
- 55
- 78
0
votes
2 answers
Android - Read tcp socket array bytes
I have a board that uses a modbus communication and I want create a connection with an android smartphone.
With the jamod library it doesn't create the connection so I used a standard tcp socket.
With this way I could create the connection and I can…

Kerberos
- 4,036
- 3
- 36
- 55
0
votes
1 answer
error C2664: 'errno_t strcpy_s(char *,rsize_t,const char *)' : cannot convert parameter 2 from 'char [512]' to 'rsize_t'
Code:
#define WIN32_LEAN_AND_MEAN
#include
#include
#include
#include
// link with Ws2_32.lib
#pragma comment(lib, "Ws2_32.lib")
#define DEFAULT_PORT "27015"
#define DEFAULT_BUFFER_LENGTH …

user2594182
- 13
- 1
- 5
0
votes
1 answer
Ruby TCPSocket Server - Can I tell to what host a client was connecting?
I have a ruby server based on TCPSocket (non-HTTP).
I have 2 different domains, both pointing with an A-Record to my servers IP Address (the same one). So, there are clients connecting to one of those domains.
Is it possible to tell which domain a…

Benedikt B
- 733
- 8
- 23
0
votes
1 answer
Socket select() Time Switching?
I have created 6 Sockets and simultaneously listening to all of them using select. I want to find out how much time does the CPU take switching from 1 socket to another. Does anyone know; if not can someone guide me please on how to compute this…

Ansh David
- 654
- 1
- 10
- 26
0
votes
1 answer
Obtaining client address with Ruby SSLSockets
I am playing with TCPSockets today and was using
@client_port, @client_addr = Socket.unpack_sockaddr_in(@socket.getpeername)
to get the client ip address and port. I've just proceeded to add SSL to the client and server but that now means…

iwasinnamuknow
- 303
- 1
- 2
- 10
0
votes
1 answer
standard C++ TCP socket, connect fails with EINTR when using std::async
I am having trouble using the std::async to have tasks execute in parallel when the task involves a socket.
My program is a simple TCP socket server written in standard C++ for Linux. When a client connects, a dedicated port is opened and separate…

Graham Briggs
- 1
- 6
0
votes
0 answers
iOS - Background method to control all the views
I've an app with two viewController and a navigation controller.
It is an app with a tcp socket communication that call the server and receive a data according to the calling page.
I have a big problem in the secondViewController because the first…

Kerberos
- 4,036
- 3
- 36
- 55
0
votes
0 answers
Node.js chat client on browser
I have a node.js chat server where I developed an iOS client, now I would like to develop another client usable on browser.
I don't want use socket.io or similiar, only pure tcp socket.
This is the code of server:
// Load the TCP Library
net =…

Kerberos
- 4,036
- 3
- 36
- 55