I am not sure if this is a bug or not but it seems strange to me. If I set
the tcp socket blocking to false and do a connect, then I can catch the
socketexception . If the exception is WSAEWOULDBLOCK, then I do a poll with
timeout to see if I can connect to the remote host. When the poll returns
true, the socket Connected property is still false. Why is this?
sock.Blocking = false;
try
{
sock.connect (...)
}
catch (SocketExceptio n e)
{
if (10035 == e.ErrorCode) // WOULDBLOCK
{
bool connected = sock.Poll (10000000, Selectmode.Sele ctWrite);
}
}
When the connected is true but the sock.Connected is still false.
Can I assume when the poll returns true, I can be sure the socket is
connected regardless of the Connected property in socket?
Thanks. 1 2564 www.vbip.com
ETYC wrote: I am not sure if this is a bug or not but it seems strange to me. If I set the tcp socket blocking to false and do a connect, then I can catch the socketexceptio n. If the exception is WSAEWOULDBLOCK, then I do a poll with timeout to see if I can connect to the remote host. When the poll returns true, the socket Connected property is still false. Why is this?
sock.Blockin g = false; try { sock.connect (...) } catch (SocketExceptio n e) { if (10035 == e.ErrorCode) // WOULDBLOCK { bool connected = sock.Poll (10000000, Selectmode.Sele ctWrite); } }
When the connected is true but the sock.Connected is still false.
Can I assume when the poll returns true, I can be sure the socket is connected regardless of the Connected property in socket?
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: faktujaa |
last post by:
Hi,
I am having some problem with callback used in socket implementation.
private static void Connect(string strPrtrIPAddr, int intPrtrPort, ref
Socket rsocClient)
{
try
{
// Create remote end point.
System.Net.IPAddress IPAddress = System.Net.IPAddress.Parse(strPrtrIPAddr);
System.Net.IPEndPoint IPEndPoint = new System.Net.IPEndPoint(IPAddress,
|
by: Joe Kinsella |
last post by:
The following code behaves differently from what I would expect:
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
System.Net.Sockets.ProtocolType.Tcp);
socket.Blocking = false;
socket.Connect(ipe);
isConnected = socket.Poll(30*1000000, SelectMode.SelectWrite);
I would have expected that once I set the socket to non-blocking, the
connect would return immediately and the poll would wait up to 30 seconds
|
by: Robert A. van Ginkel |
last post by:
Hello Fellow Developer,
I use the System.Net.Sockets to send/receive data (no
tcpclient/tcplistener), I made a receivethread in my wrapper, the
receivethread loops/sleeps while waiting for data and then fires a
datareceived event.
Within the waitingloop there is a timeout function, but I want the the
'last-time-socket-used' variable set when the socket is finished sending.
When I send by System.Net.Sockets.Socket.Send(buffer()) (<--this...
|
by: et-yc |
last post by:
I am not sure if this is a bug or not but it seems strange to me. If I set
the tcp socket blocking to false and do a connect, then I can catch the
socketexception. If the exception is WSAEWOULDBLOCK, then I do a poll with
timeout to see if I can connect to the remote host. When the poll returns
true, the socket Connected property is still false. Why is this?
sock.Blocking = false;
try
{
sock.connect (...)
|
by: Droopy |
last post by:
Hi,
I try to implement a reusable socket class to send and receive data.
It seems to work but I have 2 problems :
1) I rely on Socket.Available to detect that the connection is closed (no
more data to expect). Sometimes, Socket.Available returns 0 but the other
end of the connection did not close it !
2) This class will be used by many other classes so I have to use the
| |
by: Stressed Out Developer |
last post by:
We have an application that has a 200 count loop that does the following:
' Each time thru the loop we pass the next IP Address is a range (aka
192.168.4.50 thru 192.168.4.254)
Try
If mUIO_Threads(i) Is Nothing Then
mUIO_Threads(i) = New System.Threading.Thread(AddressOf
mUIO_DAQ(i).InitDAQ)
mUIO_Threads(i).Name = mUIO_DAQ(i).UIO_IPAddr
mUIO_Threads(i).IsBackground = False
|
by: ETYC |
last post by:
I am not sure if this is a bug or not but it seems strange to me. If I set
the tcp socket blocking to false and do a connect, then I can catch the
socketexception. If the exception is WSAEWOULDBLOCK, then I do a poll with
timeout to see if I can connect to the remote host. When the poll returns
true, the socket Connected property is still false. Why is this?
sock.Blocking = false;
try
{
sock.connect (...)
|
by: jinfeng_Wang |
last post by:
I have writen the following souce code :
m_Socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
m_Socket.Blocking = false;
try
{
m_Socket.Connect(ipEndPoint);
}
|
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: 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: 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: 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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |