Questions tagged [listen]

279 questions
1568
votes
17 answers

Who is listening on a given TCP port on Mac OS X?

On Linux, I can use netstat -pntl | grep $PORT or fuser -n tcp $PORT to find out which process (PID) is listening on the specified TCP port. How do I get the same information on Mac OS X?
pts
  • 64,123
  • 15
  • 92
  • 159
56
votes
10 answers

LoadError: Could not load the 'listen' gem (Rails 5)

I've got an API mode Rails 5 app that won't let me run rake routes or rails s. The error I get is: $ rake routes rake aborted! LoadError: Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your…
lostphilosopher
  • 3,723
  • 4
  • 24
  • 37
47
votes
10 answers

Listen to volume buttons in background service?

I know how to listen to volume buttons in an activity. But can I do that in a background service? If yes, how to do that?
user942821
38
votes
4 answers

How to determine the value of socket listen() backlog parameter?

How should I determine what to use for a listening socket's backlog parameter? Is it a problem to simply specify a very large number?
Brian R. Bondy
  • 314,085
  • 114
  • 576
  • 619
27
votes
2 answers

listen() ignores the backlog argument?

I have the following problem: I have sockfd = socket(AF_INET, SOCK_STREAM, 0) After I set up and bind the socket (let's say with sockfd.sin_port = htons(666)), I immediately do: listen(sockfd, 3); sleep(50); // for test purposes I'm sleeping for…
Markoff Chaney
  • 303
  • 3
  • 7
22
votes
4 answers

Difference between await for and listen in Dart

I am trying to create a web server stream. Here is the code: import 'dart:io'; main() async { HttpServer requestServer = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 8000); requestServer.listen((request) { //comment out this or the…
rchkm
  • 2,933
  • 5
  • 20
  • 22
22
votes
4 answers

How do I stop a Listening server in Go

I've been trying to find a way to stop a listening server in Go gracefully. Because listen.Accept blocks it is necessary to close the listening socket to signal the end, but I can't tell that error apart from any other errors as the relevant error…
Nick Craig-Wood
  • 48,112
  • 10
  • 112
  • 118
14
votes
11 answers

Is it possible to unlisten on a socket?

Is it possible to unlisten on a socket after you have called listen(fd, backlog)? Edit: My mistake for not making myself clear. I'd like to be able to temporarily unlisten on the socket. Calling close() will leave the socket in the M2LS state and…
Dave Cheney
  • 5,137
  • 2
  • 16
  • 23
14
votes
2 answers

What value of backlog should I use?

I read the man 2 listen. I don't understand what is the backlog value, it says The backlog argument defines the maximum length to which the queue of pending connections for sockfd may grow Right, how can I define what is the best value? Thanks
mathieug
  • 813
  • 1
  • 11
  • 22
13
votes
2 answers

Application path and listening port

I'd like to know which application that is listening on a port on a linux machine. There are multiple servers, apache and what not on a single machine and I'd like to know which server is listening on which port without having to dig through the…
bucabay
  • 4,909
  • 2
  • 22
  • 34
12
votes
2 answers

putting "On Change" listener on jFormattedTextField

I have a jFormattedTextField in my program and I need to update a jLabel's text when jFormattedTextField value has been changed validly. Actually jFormattedTextField gets a number and jLabel displays diffrence between this number and another…
RYN
  • 13,462
  • 29
  • 105
  • 163
11
votes
1 answer

Know the size of accept pending connections queue in GNU/Linux

In a typical C network server implementation, the size of the accept pending queue can be set with listen. When a new connection incomes and there is no more space in the queue, ECONNREFUSED is send to the client or the request is ignored. Is any…
10
votes
2 answers

How to create a UDP server in C?

I'm trying to write a UDP server in C (under Linux). I know that in the socket() function I must use SOCK_DGRAM and not SOCK_STREAM. if ( (list_s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0 ) { fprintf(stderr, "ERROR"); } But now, when I…
Marco Manzoni
  • 697
  • 3
  • 11
  • 21
9
votes
4 answers

android: how to listen to "sd card removed unexpectedly"

I have a program that uses content from sd-card. I want to listen to different states like sd-card mounted or sd-card removed unexpectedly. How can I do so. An example would be of a great help. Thanks to all
Farhan
  • 3,144
  • 13
  • 44
  • 60
9
votes
2 answers

listen() queue length in socket-programing in c?

I have written two pair of codes(server.c and client.c) in Linux. One for UNIX-domain AF_UNIX other for INTERNET-domain AF_INET. Both are working fine! listen() is called for backlog queue length = 3 in both servers listen(sockfd, 3); In UNIX…
Grijesh Chauhan
  • 52,958
  • 19
  • 127
  • 190
1
2 3
18 19