Questions tagged [sockets]

21199 questions
1

votes
0

answer
166

Views

How to stop reading from stream on a disconnect gracefully?

I have a simple socket connection that runs a read task in async. When I disconnect I get an exception: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'SslStream'. I don't know how to stop it trying to read when it is sitting and waiting to read a message when I call d...
WDUK
1

votes
0

answer
499

Views

How to remove all/single event listners in socket.io

I am using socket.io for realtime functionality in my app with hapijs. When I am trying to add a listner on server side in a hapijs route and if I reload the same route/page 10 times or more then it starts showing me an error (node:9004) MaxListenersExceededWarning: Possible EventEmitter memory leak...
Dimpal Singh
1

votes
1

answer
264

Views

My socket program doesn't print the output

Just getting started with socket programming, I have created the below code and expecting to print some byte data, but it isn't doing that. import socket def create_socket(): s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.ntohl(3)) while True: rdata, address = s.recvfrom(65535) print(rd...
Vignesh SP
1

votes
0

answer
5

Views

Getting error when setting listen() value on my socket

I am trying to allow up to 5 connections to my socket. Thus, I read I need to use the listen() function. To my understanding if I put listen(5), it means there can be at most 5 connections at any given point in time. However, I I try and run my program, I get an error. I am using Python 2.7.13 serve...
Mary
1

votes
0

answer
211

Views

UnicodeDecodeError from python 2 to 3 with .decode() and sockets

Hello i have been working on a Python code which will flash my Arduino over WiFi and i almost have it working im so close. The issue is it was created for Python 2 and i want it to run on the latest python 3. I added .encode and decode to places where socket sends or receives a string. and that work...
Edwin Martin
1

votes
0

answer
56

Views

How to disconnect from one end point and then connect to another? - C#

I have two servers and a client. One server is on the same computer where the client is. I need to disconnect from the local server and connect to the remote one. AutoResetEvent disconnectDone = new AutoResetEvent(false); IPEndPoint localEndPoint = new IPEndPoint(Dns.Resolve(Dns.GetHostName()).Addre...
J. Doe
1

votes
0

answer
198

Views

How to send broadcast data to all clients in a muti-threaded socket server?

I am currently in the process of creating a mutli-threaded chat room in python, however I am having trouble broadcasting data to all of the clients. I am hoping to create a system where one clients sends data to the server, and the server broadcasts the data to the other clients. What I am hoping to...
1

votes
1

answer
72

Views

How to close a socket which is locked in an infinite loop?

I have created a server-client project where the server keeps listening and prints the information. However, when i shutdown the client, the server remains open. The problem is that I need to insert this into another application, and, if the server does not close at first, the application will not o...
André Spironello
1

votes
0

answer
240

Views

How to connect to socket.IO using swift?

I am working with socket io using AppCoda this Tutorial. connect to socket server using node.js and swift, working fine , But it was group chat if we send the message it is showing to all users available in the socket . But How can we send messages one to one I am using socketio/socket.io-client-s...
Bittoo Praveen
1

votes
0

answer
83

Views

Signal handler triggers on first time signal is raised, but not subsequent times

I'm fairly new to signals. It's an AF_INET socket, handling SIGIO. The first connection and packet are received and handled (displayed) properly, as far as I can tell. Subsequent sends are not, however. A breakpoint on the signal handler in GDB (as well as the atomic state flag) shows that the signa...
1

votes
0

answer
44

Views

socket io and lite server issue

i integrated lite-server to my project. One of my page implement socket.io. If any action made of of my browser means same action apply into another browser. For Example, If i scroll or enter some data in to my form means, same data entered into another browser.Please help me. app module import { So...
Deepak M
1

votes
0

answer
26

Views

I am sending an int object on a socket connection but on recieving it, the result is b' '. What can I do to keep it an int object?

This is the client side which is sending the code: import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) code=123 try: sock.connect(('192.168.1.10',12345)) sock.send(code) print(sock.recv(1024).decode('ascii')) finally: sock.close()
Jodh Singh
1

votes
0

answer
57

Views

Inter process communication between c and PHP using socket

I created socket using c program and Im trying to connect it by a PHP script. and after connection im reading some values from client side, after reading the value and it is displaying on web browser, after displaying the client side(php script) is closing, i want to my php script to hold the same...
Prodigy
1

votes
2

answer
383

Views

How to know the status of tcp connect in python?

In python, tcp connect returns success even though the connect request is in queue at server end. Is there any way to know at client whether accept happened or in queue at server?
Anand
1

votes
0

answer
273

Views

Watch an API Endpoint with Socket.io

Im trying to set up web sockets to monitor changes at an API endpoint. I am able to set up web sockets across my native Node.js server and client. Server: var app = http.createServer(function(req, res){ //... }); var io = require('socket.io').listen(app); io.on('connection', function(socket) { con...
yevg
1

votes
0

answer
115

Views

Can't connect to local MySQL server through socket after system crashed

My laptop suddenly crashed with a BSD and after a restart and logging back in, mysql is causing me problems. I am using vagrant with mysql inside on UBUNTU. [email protected]:/var/lib/mysql# service mysql start Job for mysql.service failed because the control process exited with error code. See 'systemctl s...
Abad Rahman
1

votes
1

answer
55

Views

How can I determine when the network stack is ready to open socket to same host/port again?

I have the following C program whose main function runTCPConnectivityCheck opens a TCP socket, sends a string of bytes to it and closes it: #include #include #include #include #include static int runTCPConnectivityCheck(const int port) { int fd = socket(AF_INET, SOCK_STREAM, 0); if (fd < 0) { p...
Richard Cook
1

votes
0

answer
293

Views

UDP connection - Socket programming in C

I have a specific equipement (IP : 192.168.0.10 port 3000 - it's a signal receiver) that must be controlled through UDP. I should be able to send this equipement basic commands such as 'reset'; 'log' ; 'run' ... After some struggle and the gentle help of stackoverflow i managed to communicate with m...
HacHac
1

votes
1

answer
58

Views

Socket Exceptions due to density in Nodejs with WebSocket

I have node js server that is connected the 10k-14k client with WebSocket. When client count is up to above about ~14k, new clients begin to get the exception that: 'System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it' As far as I know, this...
Qwer Sense
1

votes
1

answer
101

Views

python socket not sending data in windows

I was trying to debug a library for opening ssl sockets in actionscript and encountered a problem with data not being sent through open sockets. I was able to reproduce it from python using this script:- import socket v=socket.socket() v.connect(('127.0.0.1',443)) x='\x16\x03\x01\x00W\x01\x00\x00S\x...
Sonya Roy
1

votes
0

answer
41

Views

DNS which returns 2 or more responses

I'm trying to use fake-dns server to test my code, problem is I need it to send 2 or more responses (response content isn't important). I'm using the following python code which I found in github but I couldn't find a way to make it send the response twice. Can you assist? Code is: import socket cla...
erma
1

votes
0

answer
51

Views

Binary files when readed using streams and sockets in java,not able to open the file [duplicate]

This question already has an answer here: Java multiple file transfer over socket 2 answers How to read all of Inputstream in Server Socket JAVA 3 answers I am trying to read the binary files using streams and sockets in java but was not able to open the file after reading and copying in the desti...
Ramana
1

votes
1

answer
45

Views

How to keep the server client connection on

I have used an existing node.js code to receive data from a GPS device. The code is functional but has one flaw. Ideally we want to keep the server-client connection alive. But it appears the connection is closed and then is opened very frequently. When I run the following code, the output is like...
Peter Lian
1

votes
0

answer
75

Views

Propriate way to setup dispy and SSL

I am struggling to setup dispy and SSL. Here are steps i made to setup: To create a certificate i used command: openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout private.key -out private.crt -days 3650 Then i merged two files: cat private.crt private.key > private.pem In my particular case i...
dismine
1

votes
0

answer
40

Views

Error with sockets.js

I have this error with sockets.js : GET http://localhost:3000/socket.io/?EIO=3&transport=polling&t=M3VEuNw net::ERR_CONNECTION_REFUSED in my socketCoonection socket.js exports.connectSocket = (io) => { socket.on('send-message', (message) => { messageService.sendMessage(message, (response) => { cons...
Swarnakshyari
1

votes
0

answer
499

Views

Solve idle-timeout between apache and php-fpm using FastCgiExternalServer

I'm using apache version 2.2.15 and php-fpm with php 7.1.12 and I have them communicating via a unix socket, in my apache configuration I have this setup with FastCgiExternalServer as follows FastCgiExternalServer /var/www/cgi-bin/php-fastcgi -idle-timeout 30 -socket /var/run/php-fpm/www.sock -pass...
Nathanael
1

votes
1

answer
27

Views

accept() blocks (with pending connections); Ctrl+C unblocks?

I've written a simple C++ server for my Windows desktop which talks to a mobile app I'm developing. When the two communicate, the client connects, sends some data, receives data back from the server, then the connection is closed. However, occasionally, the client will connect, send data, then ti...
Kevin Engel
1

votes
1

answer
280

Views

Implementing a client for custom TCP protocol

I have to implement a client for communication with the server by custom protocol based on XML format. This is an application layer protocol, based on TCP. So, my client sends a request XML message and receives a response, also XML message. Now, I consider how to be ensured that I received whole mes...
J. Doe
1

votes
0

answer
308

Views

Robust web Socket Streaming to Kafka in Java

I need to record from an unreliable web socket connection and stream into Kafka. Our Kafka cluster is pretty reliable and we can make it highly available. What is the best approach to make the web socket connection as reliable as possible? I would like to minimize data loss. One solution would be...
Daniel
1

votes
1

answer
203

Views

Upload file from Javascript Socket (Ps) to Golang API (Gin Gonic)

I am trying to upload a file to my server (Golang) from a photoshop script (javascript) Here is the service reading the file on the server: func Post(c *gin.Context) { // Read uploaded file file, header, err := c.Request.FormFile('file') if err != nil { c.JSON(utils.BuildError(err)) } if file == nil...
Adrien
1

votes
0

answer
66

Views

How to use an parent instance to replace child object's parent in python

Here is my code: import socket import select class My_socket(socket.socket): def __init__(self, soc = None): if soc == None: socket.socket.__init__(self, socket.AF_INET, socket.SOCK_STREAM) .... else: # how to use soc to initialize or replace parent part .... rs, ws, es = select.select([my_socket_in...
MJ Chen
1

votes
1

answer
63

Views

Trouble Invoking Move Constructor for Deque with Boost Asio Sockets

I'm trying to write a multithreading web server and I'm having a lot of trouble passing accepted boost::asio::ip::tcp::socket objects from my parent thread to my child threads. My current solution is pretty clanky since I don't think i understand proper class oriented design. Still, I want to get th...
Zeke
1

votes
0

answer
47

Views

Linux RHEL c++ socket server Bind error and SO_REUSEADDR error

At the beginning, I had problems Binding my server. I thought it was because the port(?) was still in use by a dangling process. So I added : if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *) &yes, sizeof(yes)) == -1) { cout
RETELLIGENCE
1

votes
0

answer
60

Views

Threading Loop, stop and then re-start the function every x minutes or seconds

I have my code that I have simplified, it is as follows: def my_function(): threading.Timer(10.0, my_function).start() # 10 second the function re-runs # A TCP socket function my_function() While this works, and restarts the function every 10 seconds, the socket remains open, therefore I receive an...
Infernez
1

votes
0

answer
4.2k

Views

TCP Provider: An existing connection was forcibly closed by the remote host

I'm having problems with SQL clients randomly disconnecting from the server with a TCP connection forcibly closed error message. Setup is as follows: SQL 2014 Express running on Windows Server 2008. Clients are Wi-Fi connected Microsoft Surface 3-Standard or 4-PRO's, running Windows 10 release 1703....
Jim
1

votes
0

answer
76

Views

Recvfrom windows function doesn’t receive all packets from the OS

I wrote a c++ windows process (Win7 if it matters) that can send and receive packets using sendto and recvfrom, but unfortunately not all of the packets are read from the socket. Both of the computers are directly connected and transmitting bi-directionally 2000 packets (1 packet per second, 500bit...
Shani.M
1

votes
0

answer
35

Views

c- TCP client-server Trying to disconnect the clients when I terminate the Server

I am using the signal() function to show a message whenever I terminate the server with Ctrl+C. I want to disconnect all clients connected to the server whenever I terminate it but I can't figure it out. Any suggestions?
DanaiKam
1

votes
0

answer
309

Views

IPv6 scope ID vs IPv4

Recently I was working with the Berkeley socket API for IPv6, and noticed that IPv6 addresses (sockaddr_in6) have a field called sin6_scope_id, which was not part of IPv4 addresses. After searching around a bit, I’ve learned that scope_id is meant to identify the network interface, because multipl...
Tamás Zahola
1

votes
0

answer
291

Views

ReferenceError: process is not defined, Error in heroku app with node and sockets.io

Just deployed an app (https://socket-draw-app.herokuapp.com/) on Heroku but am getting this error: ReferenceError: process is not defined. in a javascript file: sketch.js. I am using the p5.js library. Code below (firstly the sketch.js and then my server.js node file) : var socket; function setup()...
Louis
1

votes
0

answer
272

Views

Python3 non-blocking recv

I trying to do a simple server. The server has to load data while client provides it. I want to use non-blocking 'recv' command, but whatever I do it still blocks. My code is above. import socket import fcntl import os server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.b...
voltento

View additional questions