Questions tagged [sockets]

15237 questions
1

votes
2

answer
7.3k

Views

C - Creating endless socket connection between server and client (Linux)

I have a simple socket program created in C (using Ubuntu), the connection works fine, server compiles and client provides the IP and port number. But when the connection is established, the client can only send one message and then the connection closes. When the client sends the message, the serve...
hassanyf
1

votes
1

answer
748

Views

C-Socket Programming-“undefined reference”

I am a beginner in socket programming in C. I got the code in the book and when I compiled, these are following error with undefined reference. Please give a tips to correct this!Thank you! Code: #include #include #include #include #include #include #define RCVBUFSIZE 32 int main(int argc, cha...
Nguyen Tan Dat
0

votes
0

answer
3

Views

Approach to capture camera feed using openCV and then streaming the updated frames to a frontend application?

I have a scenario where I have to capture camera feed from two different cameras, and then using openCV perform analysis, save the results in a Database, and send the modified frames to the frontend application (for streaming). End-user can select which live feed to watch from the Frontend but both...
Sunny Setia
1

votes
1

answer
621

Views

How to reuse port in socket server application? [duplicate]

This question already has an answer here: Error: Address already in use while binding socket with address but the port number is shown free by `netstat` 8 answers I am trying to write a basic server socket program. I use the following code to bind the server socket. /* Bind the server socket */ if...
Razin
1

votes
1

answer
254

Views

Python multiprocess Queue get() blocks

I wrote a tiny proxy utility (tcp port-forwarder), and now trying to test it. So my test: def test_forwarding(self): route = self.config.routes[0] q = multiprocessing.JoinableQueue() proc_listen = multiprocessing.Process( target=lambda q: q.put(str( subprocess.Popen(["nc", "-l", str(route.sink[1])],...
Constantine
0

votes
0

answer
7

Views

C# socket port 443 and 80, but port 80 won't receive requests

I've created a webserver that is written in c#. It binds to port 443 for https requests for a site, but the problem is when dns is switched to this new ip, requests come to new ip from 443 but wont come to port 80. I've created 2 processes and one listen to port 443 and the other on 80. Created log...
Hamed_gibago
1

votes
1

answer
1.2k

Views

getaddrinfo and INADDR_ANY

Spent a couple of hours searching, still puzzled. From what I've found, INADDR_ANY is meant to specify that the socket will accept connections with any address that is assigned to the server. The following, however, results in the client only being able to connect to localhost:7777 from the same mac...
Raimonds Rainskis
1

votes
1

answer
16

Views

How to make this code work on windows10 machine?

I was trying to write a chat for a local network (the same with one represented in this tutorial). And when executing the code there have occured some mistakes. First of all,when one of the clients stops it's work with ctrl+c combination the command line of this client throws this exception Except...
R Georgy
1

votes
1

answer
38

Views

Random port connection while portscan

I've made a very basic port-scan program in C to scan a port range. Here it is: #include #include #include #include #include #define HOST "127.0.0.1" #define PORT 4444 int createConnection(const char *host[], const int port) { struct sockaddr_in addr; int sock = 0; int ret; struct sockaddr_in s...
Econo Mix
0

votes
1

answer
22

Views

Windows Sockets understanding recv and send

I got a little confusion here, say I do this: send(serverSocks, "Size: 1348", strlen("Size: 1348"), 0) And then Followed by this: send(serverSocks, "SomeDataThatIs1348LongAndThatNeedsToBeSent", strlen("SomeDataThatIs1348LongAndThatNeedsToBeSent"), 0) Since they are sent consecutively, there's a cha...
khin illua
2

votes
0

answer
8

Views

How to make a qml object's property “dynamically updatable” through socket connection?

I am using PyQt5 and Qml to create a client application. This is a simplified sample of my Qml file: import QtQuick 2.11 import QtQuick.Window 2.2 import QtQuick.Controls 2.2 ApplicationWindow { visible: true width: Screen.width/2 height: Screen.height/2 Rectangle { id: rectangle x: 187 y: 92 wi...
HoOman
0

votes
0

answer
19

Views

How to print and send changing IDs though python to another computer with sockets

Basically, I have my code, which finds the Lobby ID of a video-game, which then sends to my laptop. This then opens the exe with a argument and that certain Lobby ID. I want it to change when I start up another game/server. I have the script to output when the lobby ID changes, but when I plug it in...
WillBo144
8

votes
1

answer
145

Views

Efficiency Issue in the following data transfer technique via Socket communication

I've been facing this issue for very long time to implement the following scenario with a good practice. And I'm having issues. Suggest me or guide me if I went wrong somewhere. Details as follows. 1) I've a PLC that acts as a server socket program. And I have a Java Client Socket program to read th...
0

votes
1

answer
35

Views

TCP server that can handle two different client write request without blocking each other

I am trying to write a TCP server that can handle two different clients. I have a requestor and provider client. The provider is multithreaded and adds and removes new services to the server. Each time a new service is added or removed it should send it to the server and the server will print the up...
Rubiks
1

votes
0

answer
7

Views

How implement connection and data transfer between Client/Server sockets and a SSH tunnel?

Then, my original project is a remote administration tool (client => server (controller) ) that have several features like file manager, conversation (chat with client pc) between others. The communication today is made using sockets (TClientSocket and TServerSocket) without any protection of data....
Davison
1

votes
1

answer
407

Views

NSPOSIXErrorDomain when binding to socket on macOS 10.12

I am playing with CocoaAsyncSocket in Swift to bind to a UDP socket and receive messages over the local network. I am initialising a socket, and trying to bind to a port but am getting a NSPOSIXErrorDomain error. Perhaps indicating some sort of permissions issue? My code: import Cocoa import CocoaAs...
james246
1

votes
1

answer
722

Views

JS SocketIO singleton

i'm working with socket io, and would like to apply singleton pattern in order to keep the same instance of socket between different file both main.js & device.js are loaded when on mobile, but have different socket instance Main.js : import ioInstance from './socket' console.log(ioInstance) De...
Hervé
1

votes
1

answer
657

Views

Python - A request to send or receive data was disallowed because the socket is not connected

I am creating a game in Pygame that requires a client-server part for the multiplayer. First, I am checking if there are less than two connections. If this is the case, the client will be shown a screen that says 'waiting for connections'. I have got the client to successfully send a '1' message to...
Link
1

votes
1

answer
173

Views

Are TCP setup times this slow (1 second), typically?

My scenario is that I have a hundred small text files that I want to load, parse, and store in a DLL. Clients of the DLL are transient (command line programs), and I would prefer not to reload the data on every command line invocation. So, I thought I would write a Windows server to store the data a...
Kevin
1

votes
3

answer
61

Views

Problem with simple Client/Server, file gets printed wrong

Basically, the server needs to print into a file a structure filled by the client, both client and server should stop when message.fine == 1. The problem is that every time the file is created, it gets filled with thousands of zero, which indicates that the read and write function didn't work correc...
St3ve R0nix
1

votes
4

answer
79

Views

C: select() - Signal interrupt

I'm writing a multithreaded server program in C that works with AF_UNIX sockets. The basic structure of the server is: Main thread initialize data structures and spears a pool of "worker" threads. Worker threads start waiting for new requests on an empty thread-safe queue Main thread listen on vario...
Alessandro Meschi
1

votes
1

answer
49

Views

Sockets: connection refused

I made a TCP Client/Server and I can run it one time. But when I try to run it more than one time, it gives me the following error: "Connection refused". Here's my code. Client #include #include #include #include #include #include #include #include #include int main() { int net_socket = soc...
Vale
1

votes
2

answer
5.2k

Views

How can I encrypt my message when sending to the server?

I would like to encrypt my message when sending to the server from client, how can I do it? Client using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net....
lewis
2

votes
0

answer
11

Views

Socket creation speed huge difference Python3.7/Python2.7

I'm trying to create a socket, then connect to the same server until I can't make any connection from my PC and I face a problem : my program is WAY faster with Python 2.7 than with Python 3.7. Here a minimal example: import time import socket begin = time.time() socket_list = [] while True: try: s...
Pierre-Arnaud Lpt
0

votes
0

answer
2

Views

nonblocking SSL socket with multithreaded client blocking on read

I cannot write to the SSL server socket from threads which are run on the client (each thread creates a socket, CTX, SSL, ... separately). Client The client runs 2 threads, each thread creates a SSL connection. Each thread is performing three writes SSL_write: Thread1 - SSL session1 sockfd = socket(...
query
1

votes
0

answer
16

Views

Java server/client chatting program

So i am trying to create a simple java chat program that asks the user for a unique username to be stored on the server and then that username is to be used by other clients to send messages.Now the usernames are stored correctly and the messages are sent to the server correctly.However,I can't find...
Youssef
1

votes
2

answer
7.3k

Views

How can I read a byte array from a socket in Python

I am using bluetooth to send a 16-byte byte-array to a Python server. Basically what I would like to achieve is read the byte-array as it is. How can I do that in Python. What I am doing right now is reading a string since that is the only way I know how I can read data from a socket. This is my cod...
user2426316
2

votes
2

answer
23

Views

Java Socket fails to connect to “0.0.0.0” with NoRouteToHostException instead of ConnectionRefused

Problem When opening a socket to IP: 0.0.0.0 and Port: 37845 (just a random closed port) with java's socket class , the socket connect fails with a java.net.NoRouteToHostException on Machine 1 Exception in thread "main" java.net.NoRouteToHostException: No route to host (Host unreachable) at java.net...
Mino_e
1

votes
1

answer
1.3k

Views

Is there a 'writeable' test for a net.socket connection in node.js?

Is there a 'writeable' or connected test for a net.socket connection in node.js? Or do I have to do something like this: var client = new net.Socket(); var isConnected = false; client.connect(5555, 192.168.0.150, function() { isConnected = true; }); client.on('close', function() { isConnected = fals...
shaun5
1

votes
2

answer
496

Views

Why are multicast messages on the same port but from different groups combined? [duplicate]

This question already has an answer here: Duplicate packets in Python multicast receiver 1 answer On an Ubuntu 14.04 server I have two processes, each listening for multicast messages on the same port, but from different groups. I would not have expected this, but each sees traffic from both the gr...
Randall Cook
1

votes
2

answer
735

Views

Socket programming or a REST service

I was given a task of writing a server socket, which would respond to different url paths. Each url path should call a specific method on the server. For example: http://localhost/init http://localhost/method1 http://localhost/method2 I don't know if this is possible with sockets and I also think th...
TheAptKid
1

votes
2

answer
753

Views

How to send data to specific sockets created using net.createServer() connection event?

I am used to perl and POE programming when it comes to sockets, and I am looking at using node.js for an application server that is not web based. I have JavaScript knowledge from writing webpage user interfaces. I have been working with the net module and have successfully been able to connect to i...
Zanderfax
1

votes
2

answer
2.2k

Views

How to terminate a socket accept blocking

I developed a server with C code. I used the accept() function to keep my server listening on a giving socket. My server is launched in a thread. Now in other thread and for some condition I want to stop the accept() blocking and then close the related socket. How I can do that? Could shutdown() do...
MOHAMED
-1

votes
1

answer
13

Views

How do I send htm file to socket

I am trying to send this htm file to a web browser and have the browser display the contents of the file. When I run my code, all that happens is the browsers displays the name of the htm file and nothing else. try { BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream...
Jesse Burk
1

votes
1

answer
118

Views

Socket issues in Python

I'm building a simple server-client app using sockets. Right now, I am trying to get my client to print to console only when it received a specific message (actually, when it doesn't receive a specific message), but for some reason, every other time I run it, it goes through the other statement in m...
faceforest
1

votes
1

answer
3.1k

Views

Python socket error no 35

I have a strange problem. Trying to write a network app in python. Currently I am using osx and I have troubles with sockets. My code works fine on debian, but when I try to use recv(buff_size) on a connected tcp socket I get this error: socket.error: [Errno 35] Resource temporarily unavailable
fulaphex
1

votes
1

answer
8k

Views

How to make a TCP outgoing connection with Docker container?

My Go application makes TLS connections via tls.Dial() to exchange data. It works fine when run from the host: But the outgoing connection doesn't seem to work when the app is run from a Docker container. The app hangs indefinitely. Note 1: Same behavior with using docker run -p $(docker-machine ip)...
sargas
0

votes
0

answer
17

Views

bi-directional file transfer server/client with socket application

i'm trying to build a TCP/IP server/client application with C language. The client send a file to the server, the server receive the file and process it then the server send it back to client.
Khalil Meftah
1

votes
0

answer
48

Views

Connection not working from Android to UWP on desktop - ZeroMq (NetMq)

I tried some examples of ZMQ on C++,C# and Python. I am trying to have Request-Reply pattern to connect Android device to PC running UWP with Xamarin forms. Below is the Requestor code: public void HelloWorld() { var timer = new Timer(60000); timer.Start(); timer.Elapsed += (sender, args) => { this....
Prateek
0

votes
0

answer
20

Views

Socket on server: How to fix => Failed to load resource: net::ERR_TIMED_OUT

Please help me, thank so much!!!! In my localhost did walk perfectly but now I got all on my server to see how it works online and it has an problem. GET https://mydomain.io:8890/socket.io/?userid=5b344be12820260db552b202&room=5c347250ac210c52bc542f12&EIO=3&transport=polling&t=MYV9V2s net::ERR_TIMED...
gait

View additional questions