listen

C# TCP Client listening for data

二次信任 提交于 2019-12-25 07:25:04
问题 I would like to connect to a specific barcode reader at my work but currently I'm facing some problems to understand how TCP stream reading works with C#. I've looked for many code samples on stackoverflow and as I can see, people oftenly open a connection, send a command and then ask for the reply. The point is, the barcode reader just accept a TCP connection and then send the data with my data. I would like find the most efficient way to use TcpClient or NetworkStream to read in a

What's the best way for an Android app to listen for incomming TCP/IP messages?

房东的猫 提交于 2019-12-24 00:42:47
问题 I want to write an app that will listen for alarm messages whenever it is in the range of a server (on the same WiFi network). What is the best way to do this? Should I simply write a service that will act as a TCP/IP server and when it receives messages, have them generate an Android notification? or is there a better way to do this? I need this app to be running all the time while Android is running. How would I ensure that my 'listener' service is always running? thanks in advance..

Listen gem not forwarding events to guard

安稳与你 提交于 2019-12-23 01:59:06
问题 I can't get Guard to run any action. I'm using: Gentoo x64 ( 3.14.14 ) rbx-2.5.2 guard 2.11.1 listen 2.8.5 Guardfile is just catch-it-all from Understanding guard guard :rspec, cmd: "bundle exec rspec" do watch(/(.*)/) { |m| Guard::UI.puts "Unknown file: #{m[1]}"; nil } end And here is the output of $ LISTEN_GEM_DEBUGGING=2 bundle exec guard -d I, [2015-02-04T08:11:34.995518 #25370] INFO -- : Celluloid loglevel set to: 0 I, [2015-02-04T08:11:34.997566 #25370] INFO -- : Listen version: 2.8.5

27 Server Sockets

大城市里の小女人 提交于 2019-12-23 00:55:21
1 Client Socket Programming (Review) 2 Server Sockets 2.1 Binding a Socket: bind() 1. int bind(int socket, const struct sockaddr *address, socklen_t address_len); 2.2 Queuing incoming connections: listen() int listen(int socket, int backlog); backlog是指listen等待的 connect 的个数, accept 会减少listen等待的个数,如果多于这个个数则拒绝 2.3 Accepting Incoming Connections: accept() 1. int accept(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len); 2. accept返回一个文件描述符 3. server socket的文件描述符仍然存在,这样就可以接受更多的连接 4. accept 的文件描述符和 server socket 的文件描述符不相同 5. accept 会开启新的端口,而 server socket 则需要保证端口不变来接收新的连接

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

最后都变了- 提交于 2019-12-17 22:46:05
问题 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 Gemfile .../config/environment.rb:5:in `<top (required)>' LoadError: cannot load such file -- listen .../config/environment.rb:5:in `<top (required)>' Tasks: TOP => routes => environment (See full trace by running task with --trace) I've verified that listen is in the

listen() ignores the backlog argument?

荒凉一梦 提交于 2019-12-17 03:40:12
问题 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 50 seconds to test the backlog argument, which seems to be ignored because I can establish a connection* more than 3 times on port 666. *: What I mean is that I get a syn/ack for each Nth SYN (n>3) sent from the client and placed in the listen queue,

Is there a way to fire a trigger from System.out.println?

会有一股神秘感。 提交于 2019-12-13 17:44:01
问题 This might be a very dumb question but, is there a way to fire a trigger whenever something is printed to the console in Java and listen for it somewhere else? I have very little understanding of triggers or of the System class (or of Logger for that matter) so if there is an easier way of doing this (without triggers) please tell me so. We are trying to use Logger to log all of our tests. Currently, we have been using the simple "System.out.println" to log everything in the console, so I was

click listener + checkbox - on android

久未见 提交于 2019-12-13 04:34:35
问题 public class ChooseFavorites extends Activity implements OnItemClickListener { StationManager st; MyCustomAdapter arr; ListView list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_choose_favorites); st = new StationManager(); list = (ListView)findViewById(R.id.stationsList1); arr = new MyCustomAdapter(this, android.R.layout.simple_list_item_multiple_choice, st.getNamesOfStations()); list.setAdapter(arr);

Postgres LISTEN/NOTIFY - low latency, realtime?

坚强是说给别人听的谎言 提交于 2019-12-13 01:57:40
问题 I am planning to use postgres LISTEN/NOTIFY aproach to get insert time(actual transaction commit time) of records in a table. To achieve this, I plan to do the following. I issue a notification during insert time as shown below. BEGIN; INSERT INTO table_name(id, ...) values (id,....); select pg_notify('test_channel', 'id - ' || id || ' trans start time - ' || now() || ' notify start time - ' || clock_timestamp()); END; And then I plan to use https://pythonhosted.org/psycopg2/advanced.html

Share socket (listen) between unrelated processes

一笑奈何 提交于 2019-12-12 03:43:39
问题 Running in Linux 3.9 kernel and later, I have an application X, which listens on a particular socket for connections. I want to write an unrelated application, Y, which tracks the number of attempts to connect to this socket, the source IP, etc. Is it possible in c++ (ideally through Qt library) to share / monitor a socket already in use by an unrelated process? I found several StackOverflow questions which suggest forking to share the socket, but that's not possible in this case. 回答1: It is