473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

socket hangs

Hi,

I am programming asynchronous communication between client and server,
with .net asynchronous sockets example from MSDN
(http://msdn.microsoft.com/library/de...rversocket.asp)

The problem is that the application hangs on the client side, when the
server sends a buffer. It doesn't reach the read-callback (that is
assigned right after successful "Connect(server,port)") on the client
side, the app just hangs.

So: is a .net socket full-duplex, i.e. can it send and receive ?
When I the sockets are asynchronous, should the Blocking property be
set to false (since the documentation says it's true by default) ?

How can I debug the hanged app/machine to know what's really goes on,
and why the client is stuck ?

Any help would be appretiated!
Alex.
Jul 21 '05 #1
3 2312
al***@mailinator.com (Alex) wrote in
news:27**************************@posting.google.c om:
The problem is that the application hangs on the client side, when the
server sends a buffer. It doesn't reach the read-callback (that is
assigned right after successful "Connect(server,port)") on the client
side, the app just hangs.
Are you committed to async? Why not use synchronous?
So: is a .net socket full-duplex, i.e. can it send and receive ?
When I the sockets are asynchronous, should the Blocking property be
set to false (since the documentation says it's true by default) ?


It would seem so, because blocking = synchronous.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Jul 21 '05 #2
"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message news:<Xn******************@127.0.0.1>...
al***@mailinator.com (Alex) wrote in
news:27**************************@posting.google.c om:
The problem is that the application hangs on the client side, when the
server sends a buffer. It doesn't reach the read-callback (that is
assigned right after successful "Connect(server,port)") on the client
side, the app just hangs.


Are you committed to async? Why not use synchronous?


I don't want to manage a thread for each client, and,
generally, at least in MFC programming synchronous socket is an awful
idea.
There are really no synchronous sockets, and system.net socket uses
completion ports, which should make them fast enough for my needs. So,
I'll stick to asynchronous.
So: is a .net socket full-duplex, i.e. can it send and receive ?
When I the sockets are asynchronous, should the Blocking property be
set to false (since the documentation says it's true by default) ?


It would seem so, because blocking = synchronous.

Of course, but what is the difference in behaviour of asynchronous
socket with callbacks when blocking is set to true, versus false ? Do
you know ?
Jul 21 '05 #3
al***@mailinator.com (Alex) wrote in
news:27**************************@posting.google.c om:
I don't want to manage a thread for each client, and,
It depends on what you are doing, but in most cases it makes things much
easier.
generally, at least in MFC programming synchronous socket is an awful
idea.
That is not true - this is very common misconception conceived early on in
the Windows 3.1 days.
There are really no synchronous sockets, and system.net socket uses
completion ports, which should make them fast enough for my needs. So,
I'll stick to asynchronous.
There are two types of async - the message based ones and the IOCP ones.
Direct IOCP writing creates spaghetthi bug prone code.

Except under the heaviest of loads you wont notice a difference, and a single
thread queing all responses will actually respond slower because it forms a
bottlenceck.
Of course, but what is the difference in behaviour of asynchronous
socket with callbacks when blocking is set to true, versus false ? Do
you know ?


Not in this case. MS doesnt give source to this stuff, which is a real shame.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: anuradha.k.r | last post by:
hi, i am writing a socket program in python,both client side and server side.I've written the client side which is working perfectly fine(checked it against server program written in C).but as for...
4
by: Jane Austine | last post by:
Running Python 2.3 on Win XP It seems like socket is working interdependently with subprocesses of the process which created socket. ------------------------------------ #the server side >>>...
0
by: Tejaswi | last post by:
Hello! I have a J# socket client that does an HTTP Post. Code pasted below. This client works fine on my XP and Win 2003 boxes, but on my Win 2000 Server box, the socket just hangs when it tries...
10
by: feel52 | last post by:
Below you'll find the code i'm working on. It's in a button click routine and hangs after 3 or 4 sometimes 5 loops done, probably in sock.receive(....). Some code was found here( on google i mean)...
3
by: Alex | last post by:
Hi, I am programming asynchronous communication between client and server, with .net asynchronous sockets example from MSDN...
1
by: opi | last post by:
My blocking TCP server hangs in the Accept method when the client software sometimes gets an error. Are there any ways to stop this blocking in the Accept method so I dont have to restart the...
0
by: Blog the Haggis | last post by:
Hi all, I've written a program which distributes binary data to a number of clients via TCP. The program runs perfectly unless one of the client programs hangs and then it freezes while waiting...
10
by: Hendrik van Rooyen | last post by:
While doing a netstring implementation I noticed that if you build a record up using socket's recv(1), then when you close the remote end down, the recv(1) hangs, despite having a short time out...
2
by: Nicolas Le Gland | last post by:
Hello everyone here. This is my first post in this newsgroup, I hope I won't be to much off-topic. Feel free to redirect me to any better group. I am getting strange timing issues when...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.