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

Is socketbuffer empty?

Hello Fellow Developer,

This looks like a long mail, but at the end of this post is my socket
wrapper attached.
I want to make a timeout procedure that starts counting down after the
socketbuffer is empty.
This connection is being used to transmit data following a RFC so I cann't
create a control protocol that tells me the data was received.
(And even if I could, I want the timeout procedure to start after I send all
data, because that makes for me the most sense. (say I am sending 128mb the
socket will take longer sending then the timeout interval))
Any questions/remarks, NOT related to my question, pls ask directly via
email, dont post on the news server because It toke me alot of effort to
create this post.

Sample case:
if u send 1 byte from a client in Canada to a server in Australia with a 28k
modem thats being shared by an office of 30 people connected to the slowest
profider. (etc.)
What I want to say is that 1 byte may take a couple of minutes, and I use 1
byte as an
example because I don't want to make a question more complicated.

TCP/IP is a async protocol, but due to the Berkley Connection engine it
keeps track of what was send and received and what was not, so when there is
a packet loss it will send again.
So a socket keeps the data sequential, and if we are optimistic, the only
thing that can go wrong is a socket error.

There are three stadiums(simplified):
(A) My object sends to the Winsock, (buffer is being fed, no data on the
network, no data on the remote point)
(B) Winsock processes his buffer and sends on the network and waits for a
confirment that the package is succesfull transmitted(buffer is 'empty',
data on the network, no data on the remote point)
(C) All data is correctly processed and transported (buffer is truely empty,
no data on the network,data on the remote point)

Relative to the Sample case:
I achieve (A) ofcourse, I would really want to know (C), but I would be
satisfied with (B). I know (B) can be achieved, I hope (C) is too.

VB.NET FrameWork 2003(all patched and updated):
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 this doesn't work
properly (It will never timeout).
When I send by System.Net.Sockets.Socket.Send(buffer()) (<--this can be
10Mb) then it imitially returns to my thread, so the (internal) Send method
buffers it.
The System.Net.Sockets.Socket is a wrapper around the Win32 Socket 2 API's,
it makes internal calls to those api's, so I started reading if they forgot
implementing some functions, but they are all implemented.

I tried:
- The beginSend/EndSend (Async way with callback when command is finished)
This calls within the async object the Socket.Send method, so its no
help, I can better do Socket.Send myself.
- The Socket.Blocking Property, it only blocks the Receive method,
Socket.Send goes directly in the buffer and then it returns immitially.
- Socket.Poll Method, returns the accessrights of the socket, "may I use
this socket to write?"
-
getSocketOption(Socket/TCP/IP,SendBuffer/ReceiveBuffer/SendLowWater/ReceiveL
owWater/SendTimeout/ReceiveTimeout) Method
Throws an Exception

MyWrapper.vb:
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Imports System.Collections
Imports System.Threading
Imports System.Diagnostics

Public Class SmartConnection
Public Event ConnectionOpened(ByVal pMe As SmartConnection)
Public Event DataReceived(ByVal pMe As SmartConnection, ByVal Data As
Message)
Public Event CouldntConnect(ByVal pMe As SmartConnection)
Public Event ConnectionClosed(ByVal pMe As SmartConnection)
Public Event [Error](ByVal pMe As SmartConnection, ByVal pErr As
Exception)
Public Event TimeOut(ByVal pme As SmartConnection)

Private _Socket As Socket
Private _ReadThread As Thread
Private _StopThread As Thread 'Lookup threadingpool
Private _Closing As Boolean = False
Private _InError As Boolean = False
Private _lport As Long
Private lasttimeout As Long
Private pHost As String
Private pPort As Long
Private pRead As Boolean
Private pTimeout As Long
Private _Iswriting As Boolean = False

Protected Overrides Sub Finalize()
_ReadThread = Nothing
_StopThread = Nothing
_Socket = Nothing
MyBase.Finalize()
End Sub

#Region " Properties"
Public ReadOnly Property IsClosing() As Boolean
Get
IsClosing = (_Closing Or _Socket Is Nothing)
End Get
End Property

Public ReadOnly Property Connected() As Boolean
Get
Try
Connected = ((Not IsClosing) AndAlso _Socket.Connected =
True)
Catch e As Exception
OnError(e)
End Try
End Get
End Property

Protected ReadOnly Property Receiving() As Boolean
Get
Try
If Not Connected Then Throw New Exception("Socket is not
connected")
Receiving = ((Not _ReadThread Is Nothing) AndAlso
_ReadThread.IsAlive)
Catch e As Exception
OnError(e)
End Try
End Get
End Property

Public ReadOnly Property IPlocal() As String
Get
Try
If Connected Then IPlocal = EP2IPS(_Socket.LocalEndPoint)
Catch e As Exception
OnError(e)
End Try
End Get
End Property

Public ReadOnly Property IPremote() As String
Get
Try
If Connected Then IPremote = EP2IPS(_Socket.RemoteEndPoint)
Catch e As Exception
OnError(e)
End Try
End Get
End Property
#End Region
#Region " Connect"
Public Overridable Sub ConnectTo(ByRef hostName As String, ByRef port As
Long, Optional ByVal timeout As Long = 0)
Try
StartConnect(hostName, port, timeout, True)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub ConnectToWithoutReading(ByRef hostName As String, ByRef
port As Long, Optional ByVal timeout As Long = 0)
Try
StartConnect(hostName, port, timeout, False)
Catch e As Exception
OnError(e)
End Try
End Sub

Private Sub StartConnect(ByRef hostName As String, ByRef port As Long,
ByRef timeout As Long, ByRef read As Boolean)
Try
If Not _ReadThread Is Nothing Then Throw New Exception("Already
trying to connect")
_ReadThread = New Thread(AddressOf ConnectThread)
pHost = hostName : pPort = port : pRead = read : pTimeout =
timeout
_ReadThread.Start()
Catch e As Exception
OnError(e)
End Try
End Sub

Private Sub ConnectThread()
Try
If pHost = "" Then Throw New ArgumentNullException("hostname")
If pPort < IPEndPoint.MinPort Or pPort > IPEndPoint.MaxPort Then
Throw New ArgumentOutOfRangeException("port", "ArgRange_Port")
_Socket = New Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp)
Try
_Socket.Blocking = True
_Socket.Connect(New
IPEndPoint(Dns.Resolve(pHost).AddressList(0), pPort))
_lport = CType(_Socket.LocalEndPoint, IPEndPoint).Port
If Not pRead Then
SetReadName("SC.Read[PreConnect]")
_ReadThread = Nothing
Else
SetReadName("SC.EarlyRead[" & _lport & "]")
End If
OnConnectionOpened()
If pRead Then Receive()
Catch e As SocketException 'e.ErrorCode = 10061
SetReadName("SC.Read[NoConnect]")
_ReadThread = Nothing
OnCouldntConnect()
Close()
End Try
Catch e As Exception
SetReadName("SC.Read[Error]")
_ReadThread = Nothing
OnError(e)
End Try
End Sub
#End Region
#Region " Receive"
Protected Sub StartReceive()
Try
If Receiving Then Throw New Exception("Receiving was already
started")
_ReadThread = New Thread(AddressOf Receive)
SetReadName("SC.LateRead[" & _lport & "]")
_ReadThread.Start()
Catch e As Exception
OnError(e)
End Try
End Sub

Private Sub Receive()
Dim i As Long
Dim b() As Byte
'Dim ds As String, dt As String
Try
Do While Connected
If pTimeout > 0 Then lasttimeout = CurrTick() + pTimeout
Do While _Socket.Available = 0
'dt = ds
'ds = "@" & _lport & ","
'ds += _Socket.GetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendBuffer) & ","
'ds += _Socket.GetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendLowWater) & ","
'ds += _Socket.GetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.SendTimeout)
'Debug.WriteLineIf(dt <> ds, ds)
_ReadThread.Sleep(ReceiveWait)
If IsClosing Then Exit Sub
If _Socket.Poll(0, SelectMode.SelectError) Then

'System.Runtime.InteropServices.Marshal.GetLastWin 32Error())
'_Socket.GetSocketOption(SocketOptionLevel.IP,
SocketOptionName.Error)
OnError(New Exception("Socket Error"))
End If
If pTimeout > 0 Then
'If _Socket.Poll(0, SelectMode.SelectWrite) Then
'lasttimeout = CurrTick() + pTimeout
'Else
If lasttimeout <= CurrTick() Then
OnTimeOut()
Close()
Exit Sub
End If
'Endif
End If
Loop
ReDim b(_Socket.Available - 1)
'SyncLock _Socket
i = _Socket.Receive(b, SocketFlags.None)
'End SyncLock
If i < b.Length Then ReDim b(i - 1)
OnMessageReceived(New Message(b))
b = Nothing
Loop
Catch e As ThreadAbortException
Exit Sub
Catch e As Exception
OnError(e)
End Try
End Sub
#End Region
#Region " Send"
Public Overridable Overloads Sub Send(ByRef data As String)
Try
Send(getbytes(data))
Catch e As Exception
OnError(e)
End Try
End Sub

Public Overridable Overloads Sub Send(ByRef data() As Byte)
Try
If Not Connected Then Throw New Exception("Socket isn't
connected")
_Iswriting = True
'SyncLock _Socket
_Socket.Send(data)
'End SyncLock
_Iswriting = False
Catch e As Exception
_Iswriting = False
OnError(e)
End Try
End Sub
#End Region
#Region " Close"
Public Overridable Sub Close() 'OR QUEE IT?
Try
If IsClosing Then Throw New Exception("Already is closing")
_Closing = True
_StopThread = New Thread(AddressOf DoClose)
_StopThread.Name = "SC.Stop[" & _lport & "]"
_StopThread.Start()
Catch e As Exception
OnError(e)
End Try
End Sub

Private Sub DoClose()
Try
_StopThread.Sleep(CloseWait)
Try
If Not _ReadThread Is Nothing Then
SetReadName("SC.Read[Close]")
If _ReadThread.IsAlive Then _ReadThread.Abort()
End If
Catch e As Exception
End Try
Try
If Not _Socket Is Nothing AndAlso _Socket.Connected Then
_Socket.Close()
Catch e As Exception
End Try
_ReadThread = Nothing
_Socket = Nothing
_Closing = False
_StopThread = Nothing
OnConnectionClosed()
Catch e As Exception
OnError(e)
End Try
End Sub
#End Region
#Region " OnEvent"
Protected Overridable Sub OnError(ByRef pErr As Exception) 'If 2 errors
in diff threads?
Try
If Not _InError Then
_InError = True
Close()
_InError = False
End If
RaiseEvent Error(Me, pErr)
Catch e As Exception
Throw e
End Try
End Sub

Protected Sub OnTimeOut()
Try
RaiseEvent TimeOut(Me)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub OnCouldntConnect()
Try
RaiseEvent CouldntConnect(Me)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub OnConnectionClosed()
Try
RaiseEvent ConnectionClosed(Me)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub OnConnectionOpened()
Try
RaiseEvent ConnectionOpened(Me)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub OnMessageReceived(ByRef data As Message)
Try
RaiseEvent DataReceived(Me, data)
Catch e As Exception
OnError(e)
End Try
End Sub
#End Region

Private Sub SetReadName(ByRef pName As String)
If Not _ReadThread Is Nothing AndAlso _ReadThread.Name Is Nothing
Then _ReadThread.Name = pName
End Sub

End Class
Nov 15 '05 #1
2 1556
Actually Socket.Poll doesn't return the access rights, it tells you the
state of the socket. For example if you do a Send and then do a:

Socket.Poll(SelectMode.SelectRead)

It will return false until the server sends a response.

I think that's the closest you can get to what you want.

-Ron

"Robert A. van Ginkel" <ro****@stylegate.com> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...
Hello Fellow Developer,

This looks like a long mail, but at the end of this post is my socket
wrapper attached.
I want to make a timeout procedure that starts counting down after the
socketbuffer is empty.
This connection is being used to transmit data following a RFC so I cann't
create a control protocol that tells me the data was received.
(And even if I could, I want the timeout procedure to start after I send all data, because that makes for me the most sense. (say I am sending 128mb the socket will take longer sending then the timeout interval))
Any questions/remarks, NOT related to my question, pls ask directly via
email, dont post on the news server because It toke me alot of effort to
create this post.

Sample case:
if u send 1 byte from a client in Canada to a server in Australia with a 28k modem thats being shared by an office of 30 people connected to the slowest profider. (etc.)
What I want to say is that 1 byte may take a couple of minutes, and I use 1 byte as an
example because I don't want to make a question more complicated.

TCP/IP is a async protocol, but due to the Berkley Connection engine it
keeps track of what was send and received and what was not, so when there is a packet loss it will send again.
So a socket keeps the data sequential, and if we are optimistic, the only
thing that can go wrong is a socket error.

There are three stadiums(simplified):
(A) My object sends to the Winsock, (buffer is being fed, no data on the
network, no data on the remote point)
(B) Winsock processes his buffer and sends on the network and waits for a
confirment that the package is succesfull transmitted(buffer is 'empty',
data on the network, no data on the remote point)
(C) All data is correctly processed and transported (buffer is truely empty, no data on the network,data on the remote point)

Relative to the Sample case:
I achieve (A) ofcourse, I would really want to know (C), but I would be
satisfied with (B). I know (B) can be achieved, I hope (C) is too.

VB.NET FrameWork 2003(all patched and updated):
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 this doesn't work
properly (It will never timeout).
When I send by System.Net.Sockets.Socket.Send(buffer()) (<--this can be
10Mb) then it imitially returns to my thread, so the (internal) Send method buffers it.
The System.Net.Sockets.Socket is a wrapper around the Win32 Socket 2 API's, it makes internal calls to those api's, so I started reading if they forgot implementing some functions, but they are all implemented.

I tried:
- The beginSend/EndSend (Async way with callback when command is finished)
This calls within the async object the Socket.Send method, so its no
help, I can better do Socket.Send myself.
- The Socket.Blocking Property, it only blocks the Receive method,
Socket.Send goes directly in the buffer and then it returns immitially.
- Socket.Poll Method, returns the accessrights of the socket, "may I use
this socket to write?"
-
getSocketOption(Socket/TCP/IP,SendBuffer/ReceiveBuffer/SendLowWater/ReceiveL owWater/SendTimeout/ReceiveTimeout) Method
Throws an Exception

MyWrapper.vb:
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Imports System.Collections
Imports System.Threading
Imports System.Diagnostics

Public Class SmartConnection
Public Event ConnectionOpened(ByVal pMe As SmartConnection)
Public Event DataReceived(ByVal pMe As SmartConnection, ByVal Data As
Message)
Public Event CouldntConnect(ByVal pMe As SmartConnection)
Public Event ConnectionClosed(ByVal pMe As SmartConnection)
Public Event [Error](ByVal pMe As SmartConnection, ByVal pErr As
Exception)
Public Event TimeOut(ByVal pme As SmartConnection)

Private _Socket As Socket
Private _ReadThread As Thread
Private _StopThread As Thread 'Lookup threadingpool
Private _Closing As Boolean = False
Private _InError As Boolean = False
Private _lport As Long
Private lasttimeout As Long
Private pHost As String
Private pPort As Long
Private pRead As Boolean
Private pTimeout As Long
Private _Iswriting As Boolean = False

Protected Overrides Sub Finalize()
_ReadThread = Nothing
_StopThread = Nothing
_Socket = Nothing
MyBase.Finalize()
End Sub

#Region " Properties"
Public ReadOnly Property IsClosing() As Boolean
Get
IsClosing = (_Closing Or _Socket Is Nothing)
End Get
End Property

Public ReadOnly Property Connected() As Boolean
Get
Try
Connected = ((Not IsClosing) AndAlso _Socket.Connected =
True)
Catch e As Exception
OnError(e)
End Try
End Get
End Property

Protected ReadOnly Property Receiving() As Boolean
Get
Try
If Not Connected Then Throw New Exception("Socket is not
connected")
Receiving = ((Not _ReadThread Is Nothing) AndAlso
_ReadThread.IsAlive)
Catch e As Exception
OnError(e)
End Try
End Get
End Property

Public ReadOnly Property IPlocal() As String
Get
Try
If Connected Then IPlocal = EP2IPS(_Socket.LocalEndPoint)
Catch e As Exception
OnError(e)
End Try
End Get
End Property

Public ReadOnly Property IPremote() As String
Get
Try
If Connected Then IPremote = EP2IPS(_Socket.RemoteEndPoint) Catch e As Exception
OnError(e)
End Try
End Get
End Property
#End Region
#Region " Connect"
Public Overridable Sub ConnectTo(ByRef hostName As String, ByRef port As Long, Optional ByVal timeout As Long = 0)
Try
StartConnect(hostName, port, timeout, True)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub ConnectToWithoutReading(ByRef hostName As String, ByRef
port As Long, Optional ByVal timeout As Long = 0)
Try
StartConnect(hostName, port, timeout, False)
Catch e As Exception
OnError(e)
End Try
End Sub

Private Sub StartConnect(ByRef hostName As String, ByRef port As Long,
ByRef timeout As Long, ByRef read As Boolean)
Try
If Not _ReadThread Is Nothing Then Throw New Exception("Already trying to connect")
_ReadThread = New Thread(AddressOf ConnectThread)
pHost = hostName : pPort = port : pRead = read : pTimeout =
timeout
_ReadThread.Start()
Catch e As Exception
OnError(e)
End Try
End Sub

Private Sub ConnectThread()
Try
If pHost = "" Then Throw New ArgumentNullException("hostname")
If pPort < IPEndPoint.MinPort Or pPort > IPEndPoint.MaxPort Then Throw New ArgumentOutOfRangeException("port", "ArgRange_Port")
_Socket = New Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp)
Try
_Socket.Blocking = True
_Socket.Connect(New
IPEndPoint(Dns.Resolve(pHost).AddressList(0), pPort))
_lport = CType(_Socket.LocalEndPoint, IPEndPoint).Port
If Not pRead Then
SetReadName("SC.Read[PreConnect]")
_ReadThread = Nothing
Else
SetReadName("SC.EarlyRead[" & _lport & "]")
End If
OnConnectionOpened()
If pRead Then Receive()
Catch e As SocketException 'e.ErrorCode = 10061
SetReadName("SC.Read[NoConnect]")
_ReadThread = Nothing
OnCouldntConnect()
Close()
End Try
Catch e As Exception
SetReadName("SC.Read[Error]")
_ReadThread = Nothing
OnError(e)
End Try
End Sub
#End Region
#Region " Receive"
Protected Sub StartReceive()
Try
If Receiving Then Throw New Exception("Receiving was already
started")
_ReadThread = New Thread(AddressOf Receive)
SetReadName("SC.LateRead[" & _lport & "]")
_ReadThread.Start()
Catch e As Exception
OnError(e)
End Try
End Sub

Private Sub Receive()
Dim i As Long
Dim b() As Byte
'Dim ds As String, dt As String
Try
Do While Connected
If pTimeout > 0 Then lasttimeout = CurrTick() + pTimeout
Do While _Socket.Available = 0
'dt = ds
'ds = "@" & _lport & ","
'ds += _Socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer) & ","
'ds += _Socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendLowWater) & ","
'ds += _Socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout)
'Debug.WriteLineIf(dt <> ds, ds)
_ReadThread.Sleep(ReceiveWait)
If IsClosing Then Exit Sub
If _Socket.Poll(0, SelectMode.SelectError) Then

'System.Runtime.InteropServices.Marshal.GetLastWin 32Error())
'_Socket.GetSocketOption(SocketOptionLevel.IP,
SocketOptionName.Error)
OnError(New Exception("Socket Error"))
End If
If pTimeout > 0 Then
'If _Socket.Poll(0, SelectMode.SelectWrite) Then
'lasttimeout = CurrTick() + pTimeout
'Else
If lasttimeout <= CurrTick() Then
OnTimeOut()
Close()
Exit Sub
End If
'Endif
End If
Loop
ReDim b(_Socket.Available - 1)
'SyncLock _Socket
i = _Socket.Receive(b, SocketFlags.None)
'End SyncLock
If i < b.Length Then ReDim b(i - 1)
OnMessageReceived(New Message(b))
b = Nothing
Loop
Catch e As ThreadAbortException
Exit Sub
Catch e As Exception
OnError(e)
End Try
End Sub
#End Region
#Region " Send"
Public Overridable Overloads Sub Send(ByRef data As String)
Try
Send(getbytes(data))
Catch e As Exception
OnError(e)
End Try
End Sub

Public Overridable Overloads Sub Send(ByRef data() As Byte)
Try
If Not Connected Then Throw New Exception("Socket isn't
connected")
_Iswriting = True
'SyncLock _Socket
_Socket.Send(data)
'End SyncLock
_Iswriting = False
Catch e As Exception
_Iswriting = False
OnError(e)
End Try
End Sub
#End Region
#Region " Close"
Public Overridable Sub Close() 'OR QUEE IT?
Try
If IsClosing Then Throw New Exception("Already is closing")
_Closing = True
_StopThread = New Thread(AddressOf DoClose)
_StopThread.Name = "SC.Stop[" & _lport & "]"
_StopThread.Start()
Catch e As Exception
OnError(e)
End Try
End Sub

Private Sub DoClose()
Try
_StopThread.Sleep(CloseWait)
Try
If Not _ReadThread Is Nothing Then
SetReadName("SC.Read[Close]")
If _ReadThread.IsAlive Then _ReadThread.Abort()
End If
Catch e As Exception
End Try
Try
If Not _Socket Is Nothing AndAlso _Socket.Connected Then
_Socket.Close()
Catch e As Exception
End Try
_ReadThread = Nothing
_Socket = Nothing
_Closing = False
_StopThread = Nothing
OnConnectionClosed()
Catch e As Exception
OnError(e)
End Try
End Sub
#End Region
#Region " OnEvent"
Protected Overridable Sub OnError(ByRef pErr As Exception) 'If 2 errors in diff threads?
Try
If Not _InError Then
_InError = True
Close()
_InError = False
End If
RaiseEvent Error(Me, pErr)
Catch e As Exception
Throw e
End Try
End Sub

Protected Sub OnTimeOut()
Try
RaiseEvent TimeOut(Me)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub OnCouldntConnect()
Try
RaiseEvent CouldntConnect(Me)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub OnConnectionClosed()
Try
RaiseEvent ConnectionClosed(Me)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub OnConnectionOpened()
Try
RaiseEvent ConnectionOpened(Me)
Catch e As Exception
OnError(e)
End Try
End Sub

Protected Sub OnMessageReceived(ByRef data As Message)
Try
RaiseEvent DataReceived(Me, data)
Catch e As Exception
OnError(e)
End Try
End Sub
#End Region

Private Sub SetReadName(ByRef pName As String)
If Not _ReadThread Is Nothing AndAlso _ReadThread.Name Is Nothing
Then _ReadThread.Name = pName
End Sub

End Class

Nov 15 '05 #2
.....
There are three stadiums(simplified):
(A) My object sends to the Winsock, (buffer is being fed, no data on the
network, no data on the remote point)
(B) Winsock processes his buffer and sends on the network and waits for a
confirment that the package is succesfull transmitted(buffer is 'empty',
data on the network, no data on the remote point)
(C) All data is correctly processed and transported (buffer is truely

empty,
no data on the network,data on the remote point)

Relative to the Sample case:
I achieve (A) ofcourse, I would really want to know (C), but I would be
satisfied with (B). I know (B) can be achieved, I hope (C) is too.


From this high level descriptions of the problem, I would create a
Application level Msg/Ack handshake to truely make
sure the remote is responding to my local requests.

I don't think peeking into the TCP stack at one system can give
your enough info to confirm the data get to the remote.

--
Browse source code and document for .NET CLI, Mozilla, Apache, NetBSD at
http://www.slink-software.com?E=SLinkEvn_1004
Nov 15 '05 #3

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

Similar topics

4
by: Cyrus D. | last post by:
Hi guys, What's the best way to test for an empty form value ? I am doing it like this now: $test = $_POST; if(strlen($test) < 1) // it is empty ! Maybe I can just go:
13
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to...
2
by: Robert A. van Ginkel | last post by:
Hello Fellow Developer, This looks like a long mail, but at the end of this post is my socket wrapper attached. I want to make a timeout procedure that starts counting down after the...
4
by: Ramiro Barbosa, Jr. | last post by:
All, In regards to the call below, I was wondering why is it that the 'szMessage' receiving buffer results in an empty one, but by printing 'ret' it indicates the number of bytes I am indeed...
12
by: Stefan Weiss | last post by:
Hi. (this is somewhat similar to yesterday's thread about empty links) I noticed that Tidy issues warnings whenever it encounters empty tags, and strips those tags if cleanup was requested....
2
by: Andreas Palm | last post by:
I have a dataset that has DBNull in certain columns, now when I write out this one to XML, I only get the columns as elements that do have data in it. However I do need also the empty colums as...
11
by: Dan Bass | last post by:
which one do you use and why? MyString == null || MyString == "" vs MyString == null || MyString.Length == 0
2
by: Bob Stearns | last post by:
I thought that the given expression was always TRUE if "not_there" wasn't among the keys (or subscripts if you will) of $_SESSION. Below find a dump of $_SESSION, a small snippet of code and the...
14
by: cj | last post by:
What is string.empty used for? I can't say: if string.empty then I have to use: if string = "" then which is ok, I just want to know what .empty is for.
26
by: anonieko | last post by:
In the past I always used "" everywhere for empty string in my code without a problem. Now, do you think I should use String.Empty instead of "" (at all times) ? Let me know your thoughts.
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: 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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.