Hello all, I am hoping someone could point me in the right direction.
I am working on a project that requires my client socket to maintain an
active connection and reply to information form my server at long intervals.
The server "pings" the client on a regular basis when there has been no
activity in order to ascertain whether or not the connection is still active.
it sends the client a particular bit of information and waits for a
specified reply. If it does not receive that reply, it shuts its end of the
connection down.
The communication looks a bit like this: client connects, client sends some
identifying information to the server, after a period of time server sends
"ping" request to client, client responds with expected reply.
Except that I cannot, under any circumstances using the .NET socket
implementation, get this to work. The client and server can communicate fine
as long as the client had just sent information to the server. If, for
example, I want to send information to the server that communication works
fine -- but when the next time the server needs to "ping" the application,
the client does not seem to receive the communication.
I have tried async sockets, the Select function and the Poll function. For
testing, I have a very stripped down application -- it all runs in one
thread, and, in the case of the Poll and Select methodologies, the calls are
made within a while loop running in the main() function. I have verified
that the "pings" are being sent from the server, and I have encountered this
error with other languages (C and PERL).
For a variety of reasons related to the project requirements, I would prefer
to use C# for this code. Does anyone have any idea what I could be doing
wrong?
Thanks. 0 918 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: MuZZy |
last post by:
Hi,
Could someone pls help me here:
If i use async sockets in the separate thread like this:
void ThreadFunction()
{
.....
1. MySocket.BeginAccept(AsyncCallBack(OnConnectRequest), MySocket);
|
by: Shak |
last post by:
Hi all,
Three questions really:
1) The async call to the networkstream's endread() (or even endxxx() in
general) blocks. Async calls are made on the threadpool - aren't we advised
not to cause these to block?
2) You can connect together a binaryreader to a networkstream:
|
by: Shak |
last post by:
Hi all,
I'm trying to write a thread-safe async method to send a message of the form
(type)(contents). My model is as follows:
private void SendMessage(int type, string message)
{
//lets send the messagetype via async
NetworkStream ns = client.GetStream(); //assume client globally
accessible
|
by: nyhetsgrupper |
last post by:
I'm writing a server application connection to multiple clients using
sockets. I want one socket for each client, and the comunication needs
to be async. I could use the async sockets methods (beginsend,
beginrecv...) or I could start a new thread for each client and run the
comunication using the sync mehtods (send,recv). What is the best
aproach? This is a performance critical application.
|
by: rockdale |
last post by:
Hi, all
Did not find a .Net Communication forum to post.
I am soing a client/server message system and using C#.net socket and
Async mode.
Pretty much as described in article
http://www.developerfusion.co.uk/show/3997/3/
| |
by: atlaste |
last post by:
Hi,
In an attempt to create a full-blown webcrawler I've found myself
writing a wrapper around the Socket class in an attempt to make it
completely async, supporting timeouts and some scheduling mechanisms.
I use a non-blocking approach for this, using the call to 'poll' to
support the async mechanism - rather than the 'begin' and 'end'
functions. I already found that connecting doesn't set the
"isconnected" variable correctly...
|
by: dennis.richardson |
last post by:
Greetings all.
Here's a problem that's been driving me nuts for the last 48 hours.
I'm hoping that someone has come across this before.
I have a C# Application that reads a UDP broadcast (asynchronously).
Then it repackages these UDP packets and sends them to a subscriber
via TCP.
Now, I can read the UDP stream all day long without the application
|
by: Frankie |
last post by:
It appears that System.Random would provide an acceptable means through
which to generate a unique value used to identify multiple/concurrent
asynchronous tasks.
The usage of the value under consideration here is that it is supplied to
the AsyncOperationManager.CreateOperation(userSuppliedState) method... with
userSuppliedState being, more or less, a taskId.
In this case, the userSuppliedState {really taskId} is of the object type,...
|
by: Ryan Liu |
last post by:
Hi,
I have a 100 clients/ one server application, use ugly one thread pre client
approach. And both side user sync I/O.
I frequently see the error on server side(client side code is same, but I
don't see the error):
"System.IO.IOException: Unable to read data from the transport connection:A
blocking operation was interrupted by a call to WSACancelBlockingCall"
|
by: ColoradoGeiger |
last post by:
I have a fairly standard server application that I am using
asynchronous socket calls to make connections, send and receive data,
and all of that jazz. No blocking methods was my goal in writing this
and it's gone very well so far. But coming from the blocking world, I
want to have some timeouts on my receive routines and I after reading
a lot on MSDN and here, I get the impression that once I set one of
these Begin... methods a running...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |