All Questions

Tagged with
Filter by
Sorted by
Tagged with
15 votes
2 answers
24k views

How to close socket connection on Ctrl-C in a python programme

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) any_connection = False while True: try: conn, addr = s.accept() data = conn.recv(1024) ...
David Gomes's user avatar
  • 5,855
14 votes
3 answers
664 views

Android Server Socket

I am unable to reach the Android Server on the emulator from a program on my desktop, how do I solve it? Some code (from How to find LAN ip address of android device?): public static ArrayList<...
theAnonymous's user avatar
  • 1,742
13 votes
2 answers
9k views

Unix sockets slower than tcp when connected to redis

I'm developing high performance web server that should handle ~2k simultaneous connections and 40k QPS, achieving resp time < 7ms. What it does is querying Redis server (running on the same host) ...
realmaniek's user avatar
11 votes
2 answers
5k views

Android Push Notifications Without using Firebase Cloud Messaging or any other similar service

I am developing an android chat application for learning purposes that uses a server- client architecture. I wrote the server side myself in Java (because I am trying to learn) and the client side is ...
Evyatar Saias's user avatar
10 votes
2 answers
13k views

Does reading from a socket wait or get EOF?

I'm implementing a simple connection between a client and a server in C. In client side, I'm in a loop, reading from a file; every time BUFFER_SIZE bytes and sending it to the server side (didn't ...
Paz's user avatar
  • 1,031
9 votes
2 answers
1k views

C TCP sockets, echo server with file sending, hangs up after sending a file

I wanted to write a simple TCP echo server application. I managed to do the echo part, but have some problems with sending files between client and server. The idea is simple: despite sending ordinary ...
yak's user avatar
  • 3,850
9 votes
3 answers
12k views

Can a C socket recv 0 bytes without the client shutting the connection?

I've implemented a web server in C. It calls recv() on a connected, blocking socket to receive an incoming HTTP request. The Linux man pages state the following about recv() on a blocking socket: ...
dmoon1221's user avatar
  • 297
8 votes
2 answers
39k views

How can I use sys/socket.h on Windows?

I made a server with C using socket on a Linux machine and it's working fine but when I tried to run it on windows machine using visual studio, I'm getting an error: fatal error C1083: Cannot open ...
Mahmoud's user avatar
  • 85
8 votes
2 answers
6k views

Java HTTP/2 Server Socket

I want to get server sockets working for HTTP/2 in Java, preferably TLS/https. I've got a TLS server socket working fine, but browsers will only talk HTTP/1.1 to it. If I understand correctly, you ...
Jonas N's user avatar
  • 1,757
8 votes
1 answer
2k views

Julia TCP server and connection

I asked how to make TCP server that send data all the time in here: Julia TCP select and it works great. I now I have new problem, so I thought to start new conversation. I did this kind of connection ...
pinq-'s user avatar
  • 389
8 votes
1 answer
351 views

Unable to connect to local server in VPN

I have tried below code in multiple iOS, MacOS. This is server code void *run_server(void *thread_id) { int server_fd, new_socket; struct sockaddr_in server, client; int opt = 1; int ...
Bao HQ's user avatar
  • 1,144
8 votes
1 answer
2k views

PHP TCP socket connection Limit - Windows server

I have a weird issue and I can't seem to find a solution or anything closer to the issue I am having , Here is the thing , I have a scoket script run via php on command line, it accepts connection ...
Ronak K's user avatar
  • 1,567
7 votes
1 answer
4k views

Socket best practices in Java

Writing any kind of web server in Java (be it a webserver, RESTful webapp or a microservice) you get to use Sockets for dual channel communication between client and server. Using the common Socket ...
Miguel El Merendero's user avatar
7 votes
2 answers
780 views

How to send response after reading request from browser with Socket ? (I'm using SwiftSocket)

I am new to this networking in iOS so doesn't know all the concepts so well and I'm making an app which allows to show data on browser which is on device, For that I'm creating a socket-port and using ...
Nayan Dave's user avatar
  • 1,662
7 votes
2 answers
5k views

Java Socket connecting to a public ip-address

I need to make a server and client that connects to the server. Problem: "the server works. the client can only connect to localhost, it cannot connect to a server on the internet. I want the client ...
GabeTheApe's user avatar
6 votes
4 answers
7k views

How does the accept() function work?

I have a question about the accept() function in C. When a server receive a connection, the accept() function creates a new socket to communicate with the client, and then let the "old socket" ...
LogicTest's user avatar
6 votes
1 answer
12k views

C++ server side not blocking on listen()

The code below doesn't block on listen(), it just finishes execution. Could you tell me why? (initWSA returns true, I checked it). I'm following a tutorial and I was told it should block because it's ...
Greyshack's user avatar
  • 1,941
6 votes
2 answers
14k views

why do i get a bad file descriptor error?

i got an error for bad file descriptor for this code for the udp server program i made from socket import * s = socket(AF_INET, SOCK_DGRAM) s.bind(('', 890)) while True: (c,a) = s.recvfrom(1024) ...
Ravi Krishnamoorthy's user avatar
6 votes
2 answers
13k views

How recv() function works when looping?

I read in MSDN about the send() and recv() function, and there is one thing that I'm not sure I understand. If I send a buffer of size 256 for example, and receive first 5 bytes, so the next time I ...
user1386966's user avatar
  • 3,352
6 votes
3 answers
9k views

Need to transfer multiple files from client to server

I'm recently working on a project in which I'm basically making a dropbox clone. The server and client are working fine but I'm having a slight issue. I'm able to transfer a single file from the ...
Fahad Cheema's user avatar
6 votes
4 answers
13k views

Client - client communication without server?

I am new to socket programming and I need to clarify some things. Do you need a server between two client communication? Let me explain what I mean: Example 1: Client1: Server, I want to talk with ...
rootpanthera's user avatar
  • 2,741
5 votes
3 answers
15k views

Client Server multiple connections in C

I am trying to reason about how a simple server implemented in C with sockets can handle concurrent clients. Let's say a simple server waits for a client to connect and then read a message sent from ...
Keeto's user avatar
  • 4,124
5 votes
2 answers
19k views

specifying source IP-address for socket.connect() in python sockets

how do we set the source IP-address when we do __socket.connect((host, port)) on a machine that have a several ethernet interfaces?
meta_warrior's user avatar
5 votes
5 answers
9k views

select.select() arguments file descriptor cannot be a negative integer error

I am working on a simple chat app in python 3.6.1 for personal use. I get this error with select.select: Traceback (most recent call last): File "C:\Users\Nathan Glover\Google Drive\MAGENTA Chat\...
Jeffrey thesliderturtle's user avatar
5 votes
3 answers
30k views

how to test my ldap server url using telnet

i have an ldap server on my local and remote. I could telnet to my local ldap url, but i have trouble telnet to my remote. telnet www.ilovebears.com 389 and i get an empty screen with a blinking ...
bouncingHippo's user avatar
5 votes
2 answers
7k views

Microsofts Asynchronous Server Socket Example

I have a question regarding this question ("Asynchronous server socket multiple clients"). Either Microsoft changed the example since Groos answer or I really don't get it - in the example it says: ...
fose's user avatar
  • 740
5 votes
4 answers
5k views

Client not reading data from socket?

I have spent a while reading other posts, and nobody seems to have the same case as me. I have tried all solutions I have read with no results, so I decided to create this question. I have been ...
meowy cat's user avatar
  • 121
5 votes
1 answer
3k views

What is the proper way to handle multiple clients connections on linux server

Hi I am writing server on linux in C language using TCP. The server has to handle multiple connections (up to 5000 approximately). 5000 is max, but average should be about 500 - 1000. I would like to ...
Pauli's user avatar
  • 548
5 votes
2 answers
26k views

Can not set java.lang.String field to java.lang.String

I am currently developing a small MMO application with a socket server. The database i am using is PostgreSQL and i am using the Hibernate ORM. I stumbled on to a exeption when requesting all the ...
Marcel's user avatar
  • 228
5 votes
2 answers
7k views

Qt QSslSocket "The certificate is self-signed, and untrusted"

i want to connect server with QSslSocket and on server i get soketSslError "The certificate is self-signed, and untrusted" , but i dont understand why i have this error. On first step was generated ...
mr.leo's user avatar
  • 351
5 votes
1 answer
641 views

Python socket ipv6 over network not working

I am trying to connect a server to a client in python with sockets. The problem is that with ipv6 binding, it works on my local network. What I want is to connect it to another network. These programs ...
yoyopi768 yoyopi768's user avatar
5 votes
2 answers
8k views

TCP Server not receiving anything after initial connection. Python

So, I've been experimenting with Python's socket module and I've created a simple TCP client/server setup. Everything's running on the same system (Win7x64), on the ip 192.168.1.3 Here's the client (...
Awn's user avatar
  • 849
4 votes
2 answers
28k views

What is the theoretical maximum number of open TCP connections allowed on a Windows server [closed]

On my Windows server I have a port open listening to incoming TCP connections from multiple clients. Is there a limit to the number of unique clients that can concurrently establish a socket ...
Rahul J's user avatar
  • 93
4 votes
1 answer
72k views

Exception in thread "main" java.net.ConnectException: Connection refused: connect Socket Programming Java

I recently learn about Socket Programming between client and server. So I thought of doing an exercise of connecting both client and server. However, I have encountered this error message when I try ...
Silver Archer's user avatar
4 votes
1 answer
4k views

java.net.BindException: Address already in use: JVM_Bind

Server Program: import java.io.*; import java.net.*; class Server{ public static void main(String args[]){ try{ ServerSocket ss = new ServerSocket(8080); Socket s = ss....
Vinoth Vino's user avatar
  • 9,456
4 votes
2 answers
743 views

What happens to an incoming connection trying to connect to a socket already processing a request?

I can accept() incoming connections while I listen() on my socket, but once I have accept()ed a connection and am processing the request, what happens to an incoming connection request trying to ...
Anthony O's user avatar
  • 632
4 votes
1 answer
6k views

Polling TCP connections in C

I'm working on a school task where i have to make a server that gets TCP connections. Those connections then pass data. I use poll() to see if there is a new connection request or if there is incoming ...
Gus Vanherf's user avatar
4 votes
1 answer
3k views

Node.js: Client Disconnects from Server even with allowHalfOpen set to True

I am trying to make a simple Node.js script which creates a server if the assigned port is not used, or connects to the server if the port is being used. I am using a recursive approach to this (using ...
jean28's user avatar
  • 102
4 votes
1 answer
17k views

How to open a Port on Server

I am new to opening a port and server side programming. And I am trying to open a port on my server in python and then form an iOS app get some data from that port. I have done some research and know ...
james brown's user avatar
4 votes
4 answers
1k views

How to get an instance of an existing server in Node.js?

I'd like to get the number of connections of a few servers running on my local machine. I've successfully used server.getConnections() on a server created via net.createServer(), however I don't know ...
Simone's user avatar
  • 20.6k
4 votes
1 answer
91 views

Java client in socket

I have been looking for so long for a way to connect to a server created in Python using java. Can anyone show me how to connect with java and how to send string? It is recommended that it also works ...
Ziv Sion's user avatar
  • 165
4 votes
1 answer
637 views

How to read text file from server and store in dictionary using c#

I'm supposed to receive a text file from the server and then read the file and store it in a dictionary in the client. I've read the file but I'm not sure how to take out the information in the file ...
user avatar
3 votes
1 answer
1k views

socket binding won't return an int

A snippet of my code looks as follows: int descriptor = socket(AF_INET, SOCK_STREAM, 0); if(descriptor < 0){ cerr << "Error establishing socket connection." << endl; return -1; ...
dashiz's user avatar
  • 41
3 votes
3 answers
11k views

Socket in C: Proper way to close socket

I often see sample codes for a server program using socket. (For simplicity, here I don't check return values of functions such as socket() or bind() etc.) int sockfd = 0, newsockfd = 0; struct ...
Shin's user avatar
  • 37
3 votes
3 answers
3k views

How to read unicode characters from server socket

I need to receive a unicode (UTF-8) string sent by client on a server side. The length of the string is of course unknown. ServerSocket serverSocket = new ServerSocket(567); Socket clientSocket = ...
Gonzalez's user avatar
  • 681
3 votes
1 answer
5k views

Curl doesn't send entire form-data in HTTP POST request

Edit: Problem: 2 and Problem: 3 solved by following @melpomene comment i.e., by using number of bytes read to print the buffer. But still struck on Problem: 1. I have written a TCP server-client ...
ssh's user avatar
  • 491
3 votes
1 answer
9k views

What does the parameter of 1 mean in `listen(1)` method of socket module in python?

What does the parameter of 1 mean in the listen(1) method of socket. I am using the socket module in python 2.7 and I have created a basic server that I want to connect to multiple clients (all on a ...
Matt's user avatar
  • 512
3 votes
1 answer
15k views

Python ssl socket server SSLV3_ALERT_CERTIFICATE_UNKNOWN issue

I am writing a python socket server with ssl and I am encountering certificate unknown error during ssl handshake. I have created private key and certificate with openssl req -x509 -newkey rsa:4096 -...
Liju's user avatar
  • 2,303
3 votes
2 answers
11k views

C# Async Socket Server - BeginReceive in Callback

I have a simple asynchronous socket server written in C# (pretty much Microsoft's example), however the issue with this example is that it accepts only one message from a client and then shuts down. I ...
devklick's user avatar
  • 2,341
3 votes
1 answer
16k views

How to send data from Server to multiple Clients using Sockets?

I have simple server-clients programm: public class Server extends Thread { private ServerSocket server; public Server(int port) { try { this.server = new ServerSocket(...
Ruslan Lomov's user avatar

1
2 3 4 5
37