473,769 Members | 3,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asynchronous Socket Client always connected

Hi

I write dll library which one of it component will be Net socket
communication. Communication is working very good, but i've got problem when
client is connecting. When server is started, client is connecting without
problems; but when servre is down and i start client, client connect to
server!
Few lines from code:

client.Socket = new Socket(AddressF amily.InterNetw ork, SocketType.Stre am,
ProtocolType.Tc p);
client.Socket.B eginConnect(cli ent.EndPoint, new
AsyncCallback(C lient_ConnectCa llback), client);

and in callback

client.Socket.E ndConnect(ar);

Of course client.Socket.C onnected is after callback set to true.

What is strange when i call :

client.Socket.B eginSend(msg.Da ta, 0, msg.Data.Length , SocketFlags.Non e, new
AsyncCallback(C lient_SendCallb ack), client);
there is no problems.

Receive of course doesn't work.

I execute netstat.exe and connection is alive. So where is this client
connected?

Maybe somebody knew how to test this connection, or how to check this
connection is alive and working?

Of course i can check, that some data was received - but i cannot asure that
some data will be received in some time period.

regards

Kuba Florczyk
Jul 21 '05 #1
2 2522
remove it :

client.Socket.E ndConnect(ar);
news.microsoft. com wrote:
Hi

I write dll library which one of it component will be Net socket
communicatio n. Communication is working very good, but i've got problem when
client is connecting. When server is started, client is connecting without
problems; but when servre is down and i start client, client connect to
server!
Few lines from code:

client.Socke t = new Socket(AddressF amily.InterNetw ork, SocketType.Stre am,
ProtocolType.T cp);
client.Socket. BeginConnect(cl ient.EndPoint, new
AsyncCallback( Client_ConnectC allback), client);

and in callback

client.Socket. EndConnect(ar);

Of course client.Socket.C onnected is after callback set to true.

What is strange when i call :

client.Socket. BeginSend(msg.D ata, 0, msg.Data.Length , SocketFlags.Non e, new
AsyncCallback( Client_SendCall back), client);
there is no problems.

Receive of course doesn't work.

I execute netstat.exe and connection is alive. So where is this client
connected?

Maybe somebody knew how to test this connection, or how to check this
connection is alive and working?

Of course i can check, that some data was received - but i cannot asure that
some data will be received in some time period.

regards

Kuba Florczyk


Jul 21 '05 #2
Why? What that will change?

kuba
remove it :

client.Socket.E ndConnect(ar);
news.microsoft. com wrote:
Hi

I write dll library which one of it component will be Net socket
communicatio n. Communication is working very good, but i've got problem whenclient is connecting. When server is started, client is connecting withoutproblems; but when servre is down and i start client, client connect to
server!
Few lines from code:

client.Socke t = new Socket(AddressF amily.InterNetw ork, SocketType.Stre am,
ProtocolType.T cp);
client.Socket. BeginConnect(cl ient.EndPoint, new
AsyncCallback( Client_ConnectC allback), client);

and in callback

client.Socket. EndConnect(ar);

Of course client.Socket.C onnected is after callback set to true.

What is strange when i call :

client.Socket. BeginSend(msg.D ata, 0, msg.Data.Length , SocketFlags.Non e, newAsyncCallback( Client_SendCall back), client);
there is no problems.

Receive of course doesn't work.

I execute netstat.exe and connection is alive. So where is this client
connected?

Maybe somebody knew how to test this connection, or how to check this
connection is alive and working?

Of course i can check, that some data was received - but i cannot asure thatsome data will be received in some time period.

regards

Kuba Florczyk

Jul 21 '05 #3

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

Similar topics

0
1322
by: Darren Thomas | last post by:
Dear all, I have written a TCP server as a windows service that accepts connections using the System.Net.Sockets.Socket class. I use the various asynchronous methods in the socket class. I'm having a problem at the moment when I shut the service down. When I stop the service I attempt to shutdown and close the socket. But when the service is started again and the Socket.Bind statement is encountered, an error occurs telling me that it is...
2
2380
by: news.microsoft.com | last post by:
Hi I write dll library which one of it component will be Net socket communication. Communication is working very good, but i've got problem when client is connecting. When server is started, client is connecting without problems; but when servre is down and i start client, client connect to server! Few lines from code: client.Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
1
6216
by: Niels Johansen | last post by:
Hello, When using the asynchronous read method in the BufferedStream class, , it seems to me that it blocks like the normal synchronous read method. Why is it so? Why does the BufferedStream.BeginRead() not behave similar to the NetworkStream.BeginRead() ?? The following short program illustrates my problem.: using System;
4
5433
by: Matthew Groch | last post by:
Hi all, I've got a server that handles a relatively high number of concurrent transactions (on the magnitude of 1000's per second). Client applications establish socket connections with the server. Data is sent and received over these connections using the asynchronous model. The server is currently in beta testing. Sporadically over the course of the day, I'll observe the thread count on the process (via perfmon) start climbing....
0
2398
by: Richard | last post by:
Hi, I'm suffering a socket race condition - I think. The code works fine at full speed on a single CPU machine. However when I run full speed on a 2 Zeon machine the socket drops data on an asynchronous receive. If I slow a connected client down by step debugging or putting Thread.Sleep() calls between sends then the code works on the Zeon machine. Below is pseudo code that removes all error checking, try catch, business logic, and...
7
2388
by: Colin | last post by:
I'm writing a little console socket server but I'm having some difficulty. Can I ask your advice - where is the best place to get some help on that topic? It would be nice if some people who knew what they were doing could take a look at my code and tell me where and why I'm going wrong. Any suggestions of groups or forums?
2
6878
by: Macca | last post by:
My app has an asynchronous socket server. It will have 20 clients connected to the server. Each client sends data every 500 millisecondsThe Connections once established will not be closed unless there is a problem with the connection. I need to know which client has sent the incoming data as each client has its own buffer on my "server" app. I am using the standard asynch socket code from MSDN to listen for connections and they...
4
3605
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket client and asynchronous socket server example code provided in the .NET framework developers guide is a great start but I have not dealt with sockets before and I am struggling with something. From what I can tell the sample server code ...
5
8241
by: raghubr | last post by:
Hi all, Can any one pls guide me through..I need to transfer the file from server to client and client to server using sockets in an Asynchronous mode so this file transfer doesn't hinder the common process of connecting and of the server and client... here is the code i am trying to implement. this code snippet is for message transfer only for multiple clients. /////////////////////////////file receive method when sent from...
0
9422
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,...
0
10206
Oralloy
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...
0
10035
jinu1996
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...
1
9984
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,...
0
9851
tracyyun
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...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7403
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3949
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 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.