Questions tagged [listen]
In computer programming, listening is waiting for an event to occur, for example a socket waiting for an incoming request to connect to that socket. Use this tag for questions where some code will be executed once a certain event has occurred.
302
questions
2139
votes
19
answers
1.8m
views
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?
76
votes
11
answers
52k
views
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 ...
53
votes
14
answers
67k
views
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?
40
votes
5
answers
15k
views
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);
...
40
votes
3
answers
37k
views
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?
28
votes
2
answers
12k
views
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);
...
23
votes
4
answers
17k
views
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 ...
20
votes
2
answers
22k
views
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,...
15
votes
2
answers
29k
views
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 ...
14
votes
11
answers
18k
views
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 ...
12
votes
2
answers
6k
views
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 ...
12
votes
1
answer
11k
views
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 ...
11
votes
2
answers
16k
views
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 )
...
10
votes
2
answers
13k
views
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 ...
10
votes
1
answer
12k
views
android service to listen to a specific port
I want to know how to set an android service that listen to a specific port e.g. http://127.0.0.1:12345
9
votes
4
answers
6k
views
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.
...
9
votes
4
answers
25k
views
Tomcat starts without errors but not listening on 8080
I am running tomcat 6 on Centos 6.4 and have started it sucessfully. There were no errors on start. catalina.log reads:
2012-08-11 14:23:42,941 | INFO | main | o.a.c.http11.Http11NioProtocol | ...
9
votes
3
answers
6k
views
How to correctly listen for a postgresql notification from node.js
Objective:
When a new record is inserted into a specific PostgreSQL table, I would like PostgreSQL to notify my node.js web application so that it can initiate an API call to an external service.
I ...
8
votes
1
answer
20k
views
How can I stop/restart listening and accepting on a server socket in Winsock2 C++?
I made a socket (Winsock2) in Visual Studio Pro C++ to listen on a port for connections (TCP). It works perfectly, but I let it run in its own thread, and I want to be able to shut it down with the ...
8
votes
1
answer
2k
views
Can I notify and listen inside PostgreSQL procedures (functions)?
I have checked the documentation (for my version 9.3):
http://www.postgresql.org/docs/9.3/static/sql-notify.html
http://www.postgresql.org/docs/9.3/static/sql-listen.html
I have read multiple ...
7
votes
2
answers
5k
views
How to make listen gem work with Ruby 3.0.0p0
I installed Ruby 3.0.0p0 on my Macbook pro (2020 M1) and rails 6.1.3. However, whenever attempting to start up the rails server on my machine, I get the following error:
listen-3.2.1 requires ruby ...
7
votes
3
answers
11k
views
Listening to events between view controllers
I am having trouble trying to figure out how to listen to events fired in one View Controller from another ViewController.
My grid component defines a Listener
selModel: {
listeners: {
...
7
votes
1
answer
6k
views
listen() ignoring backlog value
As I understand, backlog determines the size of the connection queue. Any extra requests greater this size at that time will be dropped off(is this statment right??).
Now I have very simple program ...
6
votes
2
answers
8k
views
Does TCP use another port for sending data?
I heard that for TCP connection, server will listen on 1 port, and use another port for sending data.
For example, web server listen on port 80. Whenever client connects to it, this server will use ...
6
votes
1
answer
8k
views
Does a NodeJS server use multithreading?
I have a question about nodeJS (specifically with regards to version 9). Using this project -- https://github.com/howardchung/jsminer, I'm running a nodeJS server, if that is the right word. I spin ...
6
votes
3
answers
16k
views
HOME button doesn't work, is it possible to listen?
Ok here's my problem.
Whenever I press the HOME button nothing happens.
If i'm in an app and press it i'm not sent to the home screen like I should be.
However, if the screen is locked and i press it ...
6
votes
1
answer
3k
views
node http and express listening difference
I am new to node and express. I have come across two ways of creating an express app that listens on a specific TCP port which, as far as I can tell, yield the same result. Could someone please shed ...
6
votes
2
answers
6k
views
android listen for app launch
I need to develop a service which listen for every activity start.
Must I do something like this?
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<...
6
votes
2
answers
2k
views
How to make a C++ Program listen for system commands
I was recently asked how/if possible that one could do this. I am not sure if it is even possible, and I have been searching on it for a while now.
Basically let's take Windows for example there is a ...
5
votes
4
answers
10k
views
Node.js listen to MongoDB change
Is there a way for Node.js to listen to a change in a particular data in a collection of MongoDB, and fire an event if a change happens?
5
votes
2
answers
15k
views
Python: Listen on two ports
import socket
backlog = 1 #Number of queues
sk_1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sk_2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
local = {"port":1433}
internet = {"port":...
5
votes
1
answer
5k
views
Postgres notify: notify with row id on row create/delete/update in table
I want to create LISTE/NOTIFY pipeline with trigger_function that sent NOTIFY.
In my NOTIFY i want to get message with row id for any create/delete/update with row in table.
How can i write such ...
5
votes
2
answers
5k
views
What happens with a NOTIFY when no session has issued LISTEN in PostgreSQL?
PostgreSQL has a good listen/notify system. Documentation says:
There is a queue that holds notifications that have been sent but not
yet processed by all listening sessions. If this queue ...
5
votes
2
answers
4k
views
How to listen on a network port in Objective-C
I am trying to make an application for iPhone that can listen for traffick on a specific network port.
A server on my network is sending out messages (different status messages for devices the server ...
5
votes
2
answers
15k
views
Flutter Dio Package: How to listen to download progress from another class?
I have a DownloadsService class that handles downloading of file using dio package. I want to listen to the download progress from my ViewModel class that implements the downloadFile method inside my ...
4
votes
3
answers
51k
views
Apache server - not loading localhost [closed]
I had this problem with my Apache server not starting, because port 80 was being used by some other program, I changed the 'Listen' port number to 8888 and the server got started. But now the problem ...
4
votes
1
answer
5k
views
What is the purpose of listen() in Socket Programming? [duplicate]
ret = listen(connection_socket, 1); //allowing one connection in queue
I have opened 2 terminals and ran client process in all 2 terminals at the same time.
Here server is busy in processing ...
4
votes
1
answer
2k
views
How to listen to a random tcp socket in node.js
I know I can create a tcp server like that in node.js
var dataServer = net.createServer(function (stream) {
});
dataServer.on("listening", function() {
// this data server listen to a random ...
4
votes
2
answers
6k
views
Difference between backbone on/off (teardown) and listenTo/stopListening Implementation
I am currently using backbone to implement my app. As part of memory management, I will trigger a teardown of all the views when I am switching views
teardown: ->
for viewName, view of @subViews
...
4
votes
2
answers
2k
views
How to monitor individual files with Ruby listen gem?
I'm trying to use the listen gem (https://github.com/guard/listen) to listen to specific files, but so far have only been able to get the base functionality of listening to whole directories working ...
4
votes
2
answers
2k
views
How can I allow node to listen to ports below 1024 on Ubuntu 18.04?
I can use any PORT above 1023 with server.listen(PORT) in an nvm-installed node. How can I use system ports (e.g. below 1024) with a non-privileged user?
On our Ubuntu 16.04 servers I used to do this:...
4
votes
1
answer
6k
views
Postgres LISTEN / NOTIFY with pg-promise
I am trying to setup a simple LISTEN/NOTIFY functionality in PostgreSQL and notify node.js code using pg-promise library.
The pg code I have scaffolded is
CREATE OR REPLACE FUNCTION notify_trigger() ...
4
votes
4
answers
2k
views
How to create an application in Java EE which listens for an incoming request on TCP/IP socket?
I need to have a business logic running inside GlassFish 2.1 Appserver, which listens for inbound TCP connections and serves them. I feel that this kind of task is not really fit inside the appserver -...
4
votes
2
answers
871
views
Listening for MessageBox and Dialog results in my application
I have a "ControlMonitor" class which is designed to listen to the events that occur on a form. The way it works is, I pass the form that I want to monitor into an instance of this class, and then the ...
3
votes
3
answers
24k
views
How to get weblogic managed server listen port in runtime?
I deployed two weblogic managed instance in one server. These two instance using different port number, let say 7001 and 7002. My question is how to get port number in runtime? For example, if in ...
3
votes
2
answers
3k
views
Does listen() run continuously or do I need to loop it to keep receiving connections on a socket?
I'm running a client and server on the same machine using a loopback address for learning purposes yet my "server" code seems to fly back listen() and then hangs on my connect(). Does listen() need to ...
3
votes
2
answers
3k
views
Why does accept() block, when listen() is the very first involved in TCP?
The accept() blocks, until another connection is made and the return the sockfd the can communicate both sides on. But why is it accept() that blocks, when the first thing that is done is the three ...
3
votes
3
answers
5k
views
Node.JS .listen(port, 'hostname') does not work
at the moment I try to spin up a node.js server and I do want to understand the arguments of server.listen.
server.listen(port, hostname, backlog, callback);
Question: as far as I understand this ...
3
votes
2
answers
6k
views
How to install two Apache services
I would like two install two different apache2.2 services on a Windows machine. I already have one installed and running on ports 80 and 443. I copied the server installation directory and pasted it ...
3
votes
2
answers
208
views
importing updated files into a database
I have files that are updated every 2 hours. I have to detect the files automatically and insert the extracted information from them into a database.
Our DBMS is Postgresql and programming language ...