473,404 Members | 2,187 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,404 software developers and data experts.

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(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
client.Socket.BeginConnect(client.EndPoint, new
AsyncCallback(Client_ConnectCallback), client);

and in callback

client.Socket.EndConnect(ar);

Of course client.Socket.Connected is after callback set to true.

What is strange when i call :

client.Socket.BeginSend(msg.Data, 0, msg.Data.Length, SocketFlags.None, new
AsyncCallback(Client_SendCallback), 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 2501
remove it :

client.Socket.EndConnect(ar);
news.microsoft.com wrote:
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,
ProtocolType.Tcp);
client.Socket.BeginConnect(client.EndPoint, new
AsyncCallback(Client_ConnectCallback), client);

and in callback

client.Socket.EndConnect(ar);

Of course client.Socket.Connected is after callback set to true.

What is strange when i call :

client.Socket.BeginSend(msg.Data, 0, msg.Data.Length, SocketFlags.None, new
AsyncCallback(Client_SendCallback), 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.EndConnect(ar);
news.microsoft.com wrote:
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 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.Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
client.Socket.BeginConnect(client.EndPoint, new
AsyncCallback(Client_ConnectCallback), client);

and in callback

client.Socket.EndConnect(ar);

Of course client.Socket.Connected is after callback set to true.

What is strange when i call :

client.Socket.BeginSend(msg.Data, 0, msg.Data.Length, SocketFlags.None, newAsyncCallback(Client_SendCallback), 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
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...
2
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,...
1
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...
4
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...
0
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...
7
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...
2
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...
4
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...
5
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.