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
4
votes
2 answers

Why Socket.AcceptAsync isn't firing SocketAsyncEventArgs Completed event?

I'm developing a Server application which will receive messages and respond. Nothing really new. So, actually I'm following this answer and this post, but I can't get the AcceptAsync() method to fire the Completed event. Searched everywhere on…
Afonso Lage
  • 281
  • 5
  • 18
4
votes
1 answer

Bad File descriptor with uWSGI native async websockets and redis

Hi I have a simple websocket server which is pushing messages to clients, the code is as follows uwsgi.websocket_handshake(env['HTTP_SEC_WEBSOCKET_KEY'], env.get('HTTP_ORIGIN', '')) print("websockets...") r =…
remudada
  • 3,751
  • 2
  • 33
  • 60
4
votes
3 answers

High CPU and Memory Consumption on using boost::asio async_read_some

I have made a server that reads data from client and I am using boost::asio async_read_some for reading data, and I have made one handler function and here _ioService->poll() will run event processing loop to execute ready handlers. In handler…
Dipika
  • 584
  • 2
  • 12
4
votes
1 answer

Connection refusal on Java7 async NIO2 server

I have written a async socketserver using java 7 nio2. Here is a snipper of the Server. public class AsyncJava7Server implements Runnable, CounterProtocol, CounterServer{ private int port = 0; private AsynchronousChannelGroup group; …
dublintech
  • 16,815
  • 29
  • 84
  • 115
4
votes
1 answer

SocketAsyncEventArgs.Completed doesn't fire in Windows 8

When I compile this code on a machine with Windows 7 Ultimate and .NET 4 installed, it works just fine but when I try it on one with Windows 8 RTM and .NET 4.5 installed, Complete event never fires. class Program { private static Socket _Socket…
Şafak Gür
  • 7,045
  • 5
  • 59
  • 96
4
votes
1 answer

How to deal with a case where multiple operations are posted on the same socket

I am developing a client application that manages one socket. I am using IOCP to manage asynchronous I/O. This is a quote from a networking programming book: All overlapped operations are guaranteed to be executed in the order that the application…
jpen
  • 2,129
  • 5
  • 32
  • 56
4
votes
5 answers

How to avoid DOS attack in this code?

I have a code written in C/C++ that look like this: while(1) { //Accept struct sockaddr_in client_addr; int client_fd = this->w_accept(&client_addr); char client_ip[64]; int client_port = ntohs(client_addr.sin_port); …
user840718
  • 1,563
  • 6
  • 29
  • 54
3
votes
2 answers

Equivalent of Peek in C# async sockets?

I'm used to using synchronous sockets. In order to deal with messages that have not completely arrived yet, I'd set the first 4 bytes to be the expected length of the message. Then I'd use Socket.Receive(tcpRecv, 1024, SocketFlags.Peek); to take a…
Nikhil
  • 1,121
  • 2
  • 11
  • 27
3
votes
0 answers

SocketException inside UdpClient BeginReceive crash whole process even with a try/catch

We have a .Net application running as a service listening on an UDP port for traffic using UdpClient. It can run successfully for days and thousands of connections, but at some point the service crash with this exception in the Windows event…
Dunge
  • 532
  • 3
  • 19
3
votes
1 answer

How receive a complete screenshot in Async socket?

I have a Java android code that sends data (image or text) to a C# application, to receive these data I'm using Async socket. But exists a problem that is relative to BeginReceive() function is not receiving the complete data when is sent an image..…
FLASHCODER
  • 1
  • 7
  • 24
3
votes
1 answer

Objective C, Best way to implement a chat application (socket)

I am trying to develop a chat application. I used AsyncSocket and followed tutorial. So now I can receive a text msg from telnet using localhost. But I don't know how to handle multiple chats. Lets say three different friends know my IP address and…
codereviewanskquestions
  • 13,460
  • 29
  • 98
  • 167
3
votes
1 answer

asyncio vs asyncore for custom server python

I wanna build a custom server for some project and I don't know whats the difference between asyncore and asyncio server, what is better to use, and why
dsal3389
  • 658
  • 1
  • 7
  • 26
3
votes
2 answers

Python asyncio event loop. Run loop forever after completing an async task

Well I'm new to async in python. I'm creating a server using the call asyncio.start_server, the problem is that I'm running the same loop twice, the first time to create/start the server calling the loop.run_until_complete, and after that…
Miguel Lattuada
  • 5,327
  • 4
  • 31
  • 44
3
votes
1 answer

Listening CocoaASyncSocket on iPhone receiving connection but new socket does not call delegate

I'm trying to implement basic message pasing between two devices by specifying IPs. When one device tells its listening socket to listen as follows: UInt16 port = 59647; NSError *err = nil; [socket acceptOnPort:port error:&err]; The…
JKomusin
  • 364
  • 3
  • 14
3
votes
2 answers

TCP C# Server Python Client cannot communicate

I am writing some socket server, client application and I have a major problem. My goal is to create an async Server App in C# and a basic client APP in python. When I do follow simple examples both program work. But when I write an async Server…