473,394 Members | 1,221 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,394 software developers and data experts.

Confirmation of sent messages

I’m currently using Async sockets with .BeginReceive called to collect any message from clients.

I would like to know if the receiving socket received and processed the data sent and throw an error if not.

My problem comes when calling .receive (or as below) to check for an ACK from the client. E.g. the .BeginReceive catches the message.

I would like to use code like below
Expand|Select|Wrap|Line Numbers
  1.              Dim ns As New NetworkStream(RemoteSocket)
  2.  
  3.             '_NetworkStream.WriteTimeout = 10000
  4.  
  5.             '_NetworkStream.ReadTimeout = 10000
  6.  
  7.             Dim strResponse As String
  8.  
  9.             ' Send a string (newline terminated) to the server.
  10.  
  11.             Dim writer As New System.IO.StreamWriter(ns)
  12.  
  13.             Dim reader As New System.IO.StreamReader(ns)
  14.  
  15.             writer.Write(Message)
  16.  
  17.             writer.Flush()
  18.  
  19.             ' Read server response (up to a newline).
  20.  
  21.             Try
  22.  
  23.                 strResponse = reader.ReadLine
  24.  
  25.             Catch ex As Exception
  26.  
  27. 'Thorw error, report back send problem
  28.  
  29.                 strResponse = Nothing
  30.  
  31.             End Try
  32.  
  33.             'Close
  34.  
  35.             writer.Close()
  36.  
  37.             reader.Close()
  38.  
  39.             ns.Close()
  40.  
  41.             Return strResponse
  42.  
  43.         Catch ex As Exception
  44.  
  45.             Return Nothing
  46.  
  47.         Finally
  48.  

Any sugguestions, I understand you can’t cancel a .BeginReceive but can you override it?
Jan 9 '08 #1
1 1046
Plater
7,872 Expert 4TB
Why not use TCP instead of UDP? That protocol is much more suited to verification of data transfer and connection
Jan 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rybread | last post by:
Real quick, I have account X and I want a python script that goes in and looks for emails sent from Y and then to save them. i'm trying to go off the swen killer I have listed below (which i took...
0
by: Griff | last post by:
Hi, I have a button column placed on a datagrid at design time that is captioned "Delete". When the user clicks the button, I want to display a confirmation message, that they want to delete...
13
by: Manfred Braun | last post by:
Hi All, I am trying to understand the blocking method socket.Send(). The call blocks as expected, but does this mean, it returnes after the underlying TCP layer got a confirmation, that the send...
11
by: Prince of Code | last post by:
Hey There, I have been to this group for a couple of days. I am really impressed by the way people respond. I get answers for all my doubts and that too more info. So I am putting across a doubt...
3
by: Reedsp | last post by:
OS using: MS XP MS Access: 2003 SP2 Is their any way to turn on or off confirmation messages through VB for record changes and action queries without using the menu bar File | Options | Edit/Find...
1
by: mcfbern | last post by:
I am using a formmail.asp file to send html forms through email and then display a confirmation page to the user saying their information has been sent. Is there any way to display the information...
4
by: destinman via AccessMonster.com | last post by:
I just installed MS Access 2007. Is there any way to turn off the confirmation of action queries in 2007 ? -- Message posted via AccessMonster.com...
3
stonward
by: stonward | last post by:
Hi again Guys, I've manages to recreate some fairly cool (to me!) delete code to delete a record. However I'd like to stop the Access 'confirmation of delete' message from appearing. Is this...
6
by: simon2x1 | last post by:
the code below is my mail code its working but message sent to the email is going to the spam mail not the inbox how can make the message go to indox <?php require_once("connect.php"); //...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
marktang
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,...
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
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...

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.