sockets

Is it possible to use an Azure Web Job to listen on a public socket

百般思念 提交于 2021-01-28 09:57:50
问题 Can an Azure Web Job listen on a public TCP port (socket) I am deploying a Web Application to Azure, and it has a long running Web Job that listens to a TCP port (a custom protocol is involved, so a raw socket is required) The listener runs, but I want to send data from outside of Azure, from another on-prem machine. The port is listening OK, it can open an incoming socket, but it is internal (10.0.X.X) I suspect a public port like this is NOT possible, but I want to be 100% sure of that

TCP: What happens when client connects, sends data and disconnects before accept

∥☆過路亽.° 提交于 2021-01-28 08:46:42
问题 I'm testing some code in C and I've found strange behaviour with TCP socket calls. I've defined one listening thread which accepts clients synchronously and after accepting the client it process it in a for loop until it disconnects. Thus only one client at a time is handled. So I call accept in a loop and then recv in an inner loop until received an empty buffer. I fire 5 threads with clients, I call connect , send and finally close I get no error in any call. Everything seems to be fine.

C++ sockets client disconnect

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-28 08:18:17
问题 For learning purposes I am making my own TCP Socket class. The class is intended for handling multiple clients. Each client is stored in a vector . I am having the issue of properly removing the client from the vector when it disconnects. How can I properly remove the client on a disconnect from the vector and how can I handle incoming data accordingly? (see else branch). Currently the console gets spammed with the std::cout of the else case on a disconnect. bool socks::start() { if (listen

Socket I/O directly into a .NET memory mapped file?

纵饮孤独 提交于 2021-01-28 07:14:45
问题 Does anyone know if it is possible to read from a socket directly into a location in a memory-mapped .NET file? This happens to be a non-persistent memory-mapped file (purely in memory, no associated disk file), if that helps. Context: I'm trying to implement minimal-copying code in a situation where I have large memory-mapped objects to move from node to node in a distributed system. I'm using UDP via the standard socket library, so I had hoped to be able to read, say, 64KB off a socket (I'm

TCP sockets in c

余生颓废 提交于 2021-01-28 06:27:06
问题 I'm attempting to write a TCP socket interface for my program and I'm pulling my hair out with an accept() error (I think). For this I've created some boiled down test code. First I do a little set up int server_socket = 0; server_socket = socket(AF_INET, SOCK_STREAM, 0); int accepted_connection = 0; struct sockaddr_in server_address; server_address.sin_port = htons(9001); server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = INADDR_ANY; struct sockaddr_in client_address;

Select() + UDP resulting in too many open files

这一生的挚爱 提交于 2021-01-28 05:06:07
问题 I currently have a select() statement configured to keep track of two UDP sockers. I send perhaps 10 - 20 messages a second at one general data socket, which is this interpreted as I expected. However, once I hit around 1024 messages, I get the notice: talker: socket: Too many open files talker: failed to bind socket This is logical to me, since ulimit -n shows a max of 1024 open files for this user. However, why are there all of these open files? With UDP, there is no connection made, so I

Socket InputStream blocks on available() / read()

≡放荡痞女 提交于 2021-01-28 04:44:20
问题 I'm reading Socket InputStream, calling read() and available() works for few looping iterations. Later available() blocks indefinitely! What could be the issue? How can I make this non-blocking? Code: BufferedInputStream buffIn = new BufferedInputStream(in); while (true) { if (buffIn.available() > 0) { len = buffIn.read(buffer, 0, buffer.length); if (len == -1) { break; } baos.write(buffer, 0, len); } } 回答1: It is not blocking it is spinning. Once there is no data available you code might as

boost: readline for tcp client

拟墨画扇 提交于 2021-01-28 04:20:45
问题 I'm developing a tcp server in c++ using boost. I'd like process incoming data line by line and am looking for a socket.readLine method. However, I can only find a read_some() method. I don't what the definition on "some" is, but I don't think the string necessarily ends with a "\n". So how can I implement socket.readLine() using boost? 回答1: I assume you are using boost::asio. If so, there is a read_until() function that does what you want. http://www.boost.org/doc/libs/1_47_0/doc/html/boost

Socket Programming design questions

陌路散爱 提交于 2021-01-28 02:59:10
问题 I'm messing around (for the first time) with Socket programming in C#, I'm making a Skype like application(Video call, IM, file share, screen share) and i have a couple of questions... 1) How should sockets truly work? On the client side I have a while loop which is effictively keeping the socket open, Is this correct? Or should i be closing the socket after each Send/Recieve (Im using BeginSend() and BeginRecieve()) and creating a new socket? interact() is called after the connection has

Spring Integration TCP - Initiate handshake with a message before sending data

随声附和 提交于 2021-01-28 02:58:54
问题 I am using @MessagingGateway to send data to to server. I configured a AbstractClientConnectionFactory and a @ServiceActivator for my outbound gateway. In order to send data to my server, I need to send a handshake message when the connection is initiated. If the response from server is the response that I expect for the handshake, then I send meaningful data. My initial solution is if (gateway.handshake(HANDSHAKE).equals(HANDSHAKE_RESPONSE)) gateway.sendData(data); This is not so good when i