sockets

Why Does C# Console Application Stop Running When Text is HIghlighted?

 ̄綄美尐妖づ 提交于 2021-01-28 02:41:11
问题 I have a console application which acts as a Synchronous Server Socket to receive data from a Synchronous Client Socket on the same machine. After sending some data a few times from the Client to the Server I realize that if I were to highlight some text in the console, it would stop running code and the Client would not be able to establish a connection. I'd like to know the reason why this happens and if there is a way to make the code still run. 回答1: Essentially, the console is locked, to

Can I free my data immediately after send() in blocking mode?

天大地大妈咪最大 提交于 2021-01-28 02:06:23
问题 the docs say for send: When the message does not fit into the send buffer of the socket, send() normally blocks, unless the socket has been placed in non-block- ing I/O mode. In non-blocking mode it would return EAGAIN in this case. The select(2) call may be used to determine when it is possible to send more data. I am in blocking mode, doing something along the lines of: buf = malloc(size); send (socket, buf, size); free(buf) Assume but is very large, larger than the buffer can hold at a

Where is io.sockets.adapter.rooms in io of nodejs?

北慕城南 提交于 2021-01-28 01:52:41
问题 https://stackoverflow.com/a/6727354/462608 The short answer: io.sockets.adapter.rooms I analysed io: The sockets output part from io as shown in that answer contains the following: sockets: { manager: [Circular], name: '', sockets: { '210837319844898486': [Object] }, auth: false, flags: { endpoint: '', exceptions: [] }, _events: { connection: [Function] } }, Where is the adapter ? Where are the rooms ? What is the way to find out adapter and rooms from the output of io ? 回答1: I think you are

C# Async Socket Server - BeginReceive in Callback

只愿长相守 提交于 2021-01-28 01:45:00
问题 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 want this server to stay alive after receiving any message. This question has been asked before here, and the answer & comments explain that the resolution to this is simply to call handler.beginReceive within the SendCallback function, however to do this requires passing in a state variable.

Socket programming in C, using the select() function

梦想的初衷 提交于 2021-01-28 01:10:54
问题 Based from the answers I got from this thread, I've created this: //Server sock_init(); //from SFL, see http://legacy.imatix.com/html/sfl/ timeout = 50000; serv_sock_input[0] = TCP(1234); serv_sock_input[1] = UDP(9876); input_protocols[0] = "tcp"; input_protocols[1] = "udp"; while (1) { FD_ZERO(&sock_set); for (x = 0; x<number_of_inputs; x++) { FD_SET(serv_sock_input[x], &sock_set); } select_timeout.tv_sec = timeout; select_timeout.tv_usec = 0; if (select(0, &sock_set, NULL, NULL, &select

freeing argument in function specified in pthread_create

风格不统一 提交于 2021-01-27 23:34:04
问题 I am writing a small server which creates a new thread to handle each new connection. I need to pass the socket to the function using the fourth argument of pthread_create. When trying to free the memory used for the socket i get a segfault. The communication works fine. I have tried passing a void* and also a void** (casted to void*, kind of ugly) This is the latest cludge i'm using while trying to figure this out, later if will be doing actual work in the respond function. #include <sys

How to easily solve the 10040 message too long error on Wsock2

放肆的年华 提交于 2021-01-27 21:36:32
问题 I'm sending from a .Net application 1404 float values which make up for 5616 bytes through an udp socket. I get no exceptions off this operation. However, the program receiving those data, is a C++ application, and when receiving such amount of data I get a 10040 message too long error. Apparently 1480bytes is the longest size possible for messages in Wsock2. What would be the easiest, cleanest way to fix this? Thanks! EDIT: Posting some code: This is my socket J_Receive class: #include "J

How to handle hooked WSARecv

痴心易碎 提交于 2021-01-27 18:17:47
问题 I'm working on a project that involves hooking WSARecv . I know how to hook this function, I mean its just the same as hooking another function. Anyway the hard part is when WSARecv is used to perform overlapped operations. The idea is that when an application receives data to intercept that and be possible to modify this, I'm using pipes for this. The native DLL tunnels all data to a managed 'server'. This processes the input etc and returns it back to the native DLL. This works great for

How to re render table component upon receiving a notification from web socket in React JS?

大憨熊 提交于 2021-01-27 17:43:26
问题 Im using React table and loading a page which displays a table with data fetched from an API. Im also listening on a web socket and right now, whenever something is sent over a web socket, Im printing a console message. Now I want to reload the table(in turn making the API call) when I receive any update on the web socket. class TableExp extends React.Component { constructor() { super(); this.state = { tableData: [ { resourceID: '', resourceType: '', tenantName: '', dealerID: '', status: '',

difference between file descriptor and socket file descriptor

丶灬走出姿态 提交于 2021-01-27 13:21:09
问题 Can I bind a file descriptor returned by open call to a socket? I am trying to do something like, filefd = open("path",O_RDWR); ... bind (filefd, (struct sockaddr *) &servaddr, sizeof(servaddr)); connfd = accept (filefd, (struct sockaddr *) &cliaddr, &clilen); Why does the accept call return -1? 回答1: From an applications point of view, the difference is how you create and use the descriptor. Some system-calls can take any kind of descriptor, while others require a specific type of descriptor.