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
9
votes
3 answers

.NET question about asynchronous socket operations and message framing

I've been looking everywhere for examples on how to deal with TCP message framing. I see many examples where NetworkStreams are passed into a StreamReader or StreamWriter object and then use ReadLine or WriteLine methods for '\n' delimited messages.…
Andrew
  • 93
  • 1
  • 3
9
votes
1 answer

python asyncio run event loop once?

I am trying to understand the asyncio library, specifically with using sockets. I have written some code in an attempt to gain understanding, I wanted to run a sender and a receiver sockets asynchrounously. I got to the point where I get all data…
vitiral
  • 8,446
  • 8
  • 29
  • 43
8
votes
1 answer

Nonblocking sockets: Are messages queued?

As I understand, it is possible to create a nonblocking network socket in PHP 5.x. But what happens if a script sends several long messages using the same nonblocking socket as follow: socket_write($socket, $string1, $length); socket_write($socket,…
Mike
  • 1,992
  • 4
  • 31
  • 42
8
votes
1 answer

Fast Repeat TakeWhile causes infinite loop

How can I make the following observable repeat until stream.DataAvailable is false? Currently it looks like it never stops. AsyncReadChunk and Observable.Return inside the Defer section make OnNext call then OnCompleted call. When Repeat receives…
Samet S.
  • 475
  • 1
  • 10
  • 21
8
votes
1 answer

How to gracefully close an Async Server Socket? C#

I've seen a lot of questions about handling Sockets without object disposed exceptions, so I've decided to take a crack at it and see if it could be done. Here are my findings. Problem? You have a piece of code that uses a Socket from…
Aelphaeis
  • 2,593
  • 3
  • 24
  • 42
7
votes
6 answers

GCDAsyncSocket - not receiving data - AsyncSocket works ok

I made an iPhone client connect to a server using GCDAsyncSocket. The server is running .Net on a Windows server. The connect is good and it sends data well too. I then tell the client to go into receive directly after the send... [sock…
Mark Worsnop
  • 4,407
  • 15
  • 54
  • 79
7
votes
1 answer

Must call EndRead() in ALL cases?

Related to asynchronous IO using a (bidirectional) NetworkStream, MSDN says that "EndRead must be called once for every call to BeginRead." Is this true even for cases where the EndRead() will throw an exception, such as in the case that the…
Jason Kleban
  • 20,024
  • 18
  • 75
  • 125
7
votes
1 answer

How to handle timeout in Async Socket?

I have a code that using async socket to send message to client and expecting response from it. If the client did not reply in a specified internal it will considers timeout. Some of the article in Internet suggest to use WaitOne, but this will…
kevin
  • 275
  • 1
  • 5
  • 13
7
votes
2 answers

Unhandled Exception error from a callback c#

I have a 3 tier architecture and send some data in the transport layer (TCP Client) using tcp sockets is this methods asynchronously using BeginSend method. public void TransportData(Stream stream) { try { …
user466898
  • 83
  • 1
  • 7
7
votes
1 answer

Asynchronous Socket Client Buffer Size

I have to connect a remote server with asynchronous socket connection and retrieve data. I can connect but there is a problem. Packages are sending by pieces. I have two options; I can set a buffer and get whole package in one piece or combine…
Deniz B.
  • 2,532
  • 1
  • 18
  • 35
7
votes
2 answers

C# Socket ReceiveAsync

I am used to sync sockets and had a few headaches to get to the point where I am now, especially with Socket.Receive(..) not always receiveing all bytes Here is my code what I used to use public byte[] Receive(int size) { var buffer…
Donald Jansen
  • 1,937
  • 4
  • 22
  • 41
7
votes
2 answers

is there any pool for ThreadingMixIn and ForkingMixIn for SocketServer?

I was trying to make an http proxy using BaseHttpServer which is based on SocketServer which got 2 asynchronous Mixins (ThreadingMixIn and ForkingMixIn) the problem with those two that they work on each request (allocate a new thread or fork a new…
7
votes
1 answer

How to use a TurnSocket (XEP-0065: SOCKS5 Bytestreams) connection? XEP-0096: SI File Transfer? [socket writeData]?

I'm attempting file transfer via XMPP on iOS using the XMPPFramework and OpenFire. The base of my code is from the following tutorial. I have a successful TurnSocket (XEP-0065: SOCKS5 Bytestreams) connection, but I can't work how to use it to send…
Andy A
  • 4,191
  • 7
  • 38
  • 56
6
votes
1 answer

Finding out the port an asynchronous socket is binding to?

Since version 6.d of Perl 6, you can use port 0 to ask the interpreter to find a port to bind for you: my $socket = IO::Socket::Async.listen($SOCKET_ADDR, 0); However, $socket is a Supply with no information on the low-level socket it's using. What…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
6
votes
1 answer

C# Async Webserver - how to send data to client

This might be a piece of cake for any experienced C# developer What you see here is a sample Asynchronous webserver using System; using System.Text; using System.Net; using System.Net.Sockets; using System.Threading; namespace SimpleServer { …
jprealini
  • 349
  • 4
  • 17
1
2
3
39 40