Questions tagged [asyncsocket]

Asynchronous sockets allow for multiple simultaneous non-blocking socket connections.

Asynchronous sockets allow for multiple socket connections within a single thread. While more complicated than synchronous sockets, asyncsockets allow for more efficient use of cpu scheduling. These connections are non-blocking, which allows the main program thread to continue running, while a socket thread manages network traffic.

589 questions
6
votes
2 answers

ZeroMQ pattern for load balancing work across workers based on idleness

I have a single producer and n workers that I only want to give work to when they're not already processing a unit of work and I'm struggling to find a good zeroMQ pattern. 1) REQ/REP The producer is the requestor and creates a connection to each…
Arne Claassen
  • 14,088
  • 5
  • 67
  • 106
6
votes
4 answers

How to set a timeout value on StreamSocket's ConnectAsync()?

In the Windows Phone 8.1 app I had to create my socket as follows. How can I change it so that it will timeout after a period that I can specify? _socket = new StreamSocket(); await _socket.ConnectAsync(hostName, port.ToString(),…
DaveDev
  • 41,155
  • 72
  • 223
  • 385
6
votes
1 answer

Socket.Shutdown throws SocketException

I'm trying to implement async sockets for my project. Here's the code public void Start(int listeningPort) { var ipHostInfo = Dns.Resolve(Dns.GetHostName()); var ipAddress = ipHostInfo.AddressList[0]; var…
Davita
  • 8,928
  • 14
  • 67
  • 119
6
votes
1 answer

SocketAsyncEventArgs buffer is full of zeroes

I'm writing a message layer for my distributed system. I'm using IOCP, ie the Socket.XXXAsync methods. Here's something pretty close to what I'm doing (in fact, my receive function is based on…
Carlos
  • 5,991
  • 6
  • 43
  • 82
5
votes
2 answers

AsyncUDPSocket broken pipe after locking phone with application suspended in background

I'm using the AsyncUDPSocket third party library in my iPhone app and for the most part it works great. I have a singleton instance of an AsyncUDPSocket that I use for all my network traffic. My app is registered for location tracking in the…
Kongress
  • 2,244
  • 3
  • 20
  • 30
5
votes
0 answers

Socket.BeginReceive: Timeout if data doesn't come through?

I'm doing a variable-length message receive similar to this question where the length of the body of my message is specified in a header, and I async-read the body in a loop until it's all been transferred. However, due to the network sometimes this…
5
votes
2 answers

C# Async TCP Server overkill?

This is really an implementation question so I feel it's best to start with my specific case. I've got a C# server that listens for TCP connections asynchronously from mobile clients. When a mobile client connects a new thread is started, the…
zkwentz
  • 1,095
  • 5
  • 22
  • 44
5
votes
1 answer

Using AsyncSocket with secondary threads on the iPhone

I use AsyncSocket on the iPhone to communicate with a server. AsyncSocket is based on run loops but my app is based on threads. That means, I start a new thread to write data and wait until a response is received on the same thread. But I can't call…
Arthur
  • 151
  • 1
  • 1
  • 6
5
votes
1 answer

how to handle tcp client socket auto reconnect in python asyncio?

I am using python asyncio streams to connect to several socket servers, but when the server is down, my code can't auto reconnect. What I need is that, when the server is down, my script will try to reconnect every 5 seconds, until connected and…
Desmond Chen
  • 492
  • 5
  • 17
5
votes
1 answer

How to receive data from server through socket in iOS?

I have an application in which i have to send data to server using socket connection and read data which will send by server. I am using AsyncSocket class for write and read data. I got success to write data on server and server can see the data…
Birju
  • 1,132
  • 11
  • 32
5
votes
2 answers

Boost.asio and asynchronous chain, unique_ptr?

I am not deeply familiar with async programming and I have a question. My question is the following. Given the echo_server example here for C++11 in boost.asio:…
Germán Diago
  • 7,473
  • 1
  • 36
  • 59
5
votes
2 answers

Set timeout for boost socket.connect

I am using boost::asio::connect on a tcp::socket. When all goes fine, the connect returns immediately but on a poor network, the connect times out after a log wait of 15 seconds. I cannot afford to wait that long and so want to reduce the timeout.…
BTR Naidu
  • 1,063
  • 3
  • 18
  • 45
5
votes
1 answer

Memory Issue with async socket and begin Send

I noticed the today that my one application im developing is seriously growing in memory. So I did a Visual Studio Memory Profile and I found the following results: Function Name Inclusive Allocations Exclusive Allocations Inclusive Bytes…
Zapnologica
  • 22,170
  • 44
  • 158
  • 253
5
votes
3 answers

How to implement voice chat in cocoa?

I have made a simple chat application using AsyncSocket class where client nodes can send message to each other via chat server application. I want to integrate voice chat functionality in it but I am not getting any material over net which can…
Devarshi
  • 16,440
  • 13
  • 72
  • 125
5
votes
1 answer

WebSocket Chat Async Example Crash

I have been trying to run the websocket chat example provided here on an Apple Mac. https://github.com/unbit/uwsgi/blob/master/tests/websockets_chat_async.py But running this example results in a segfault in uwsgi. I have copied pasted this example…
remudada
  • 3,751
  • 2
  • 33
  • 60
1 2
3
39 40