Hello, I am having a bit of trouble understanding how tcp/ip works. As
a point of reference, with a serial port you essentially get byte by
byte in the same order that it was sent out.
With TCP/IP, because it may route individual packets via different
paths, does a possibility exist that I will get some packets out of
order? Or is this something that is handled by the tcp/ip stack?
Secondly, how can I send tcp/ip data (i.e. length of data) to guarantee
that when I call do the following:
byte[] Receiving = new byte[100000];
m_Socket.Receive(Receiving, 0, m_Socket.Available, SocketFlags.None);
that I get everything I sent in one shot. So for instance, if the
client sends: "the brown fox jumped over the i can't remember what", I
want to be sure that when the server calls the piece of code above, that
the entire string is in the Receiving array.
Thanks. 5 2392
In article <uC**************@TK2MSFTNGP10.phx.gbl>, Frank Rizzo wrote: Hello, I am having a bit of trouble understanding how tcp/ip works. As a point of reference, with a serial port you essentially get byte by byte in the same order that it was sent out.
With TCP/IP, because it may route individual packets via different paths, does a possibility exist that I will get some packets out of order? Or is this something that is handled by the tcp/ip stack?
TCP guarentees that you will recieve the packets in the order they were
sent. UDP on the other hand does not.
Secondly, how can I send tcp/ip data (i.e. length of data) to guarantee that when I call do the following:
byte[] Receiving = new byte[100000]; m_Socket.Receive(Receiving, 0, m_Socket.Available, SocketFlags.None);
that I get everything I sent in one shot. So for instance, if the client sends: "the brown fox jumped over the i can't remember what", I want to be sure that when the server calls the piece of code above, that the entire string is in the Receiving array.
You can't. That's why tcp based protocols generally include some sort
of end of message dilimiter.
--
Tom Shelton [MVP]
Tom Shelton wrote: In article <uC**************@TK2MSFTNGP10.phx.gbl>, Frank Rizzo wrote:
Hello, I am having a bit of trouble understanding how tcp/ip works. As a point of reference, with a serial port you essentially get byte by byte in the same order that it was sent out.
With TCP/IP, because it may route individual packets via different paths, does a possibility exist that I will get some packets out of order? Or is this something that is handled by the tcp/ip stack?
TCP guarentees that you will recieve the packets in the order they were sent. UDP on the other hand does not.
Secondly, how can I send tcp/ip data (i.e. length of data) to guarantee that when I call do the following:
byte[] Receiving = new byte[100000]; m_Socket.Receive(Receiving, 0, m_Socket.Available, SocketFlags.None);
that I get everything I sent in one shot. So for instance, if the client sends: "the brown fox jumped over the i can't remember what", I want to be sure that when the server calls the piece of code above, that the entire string is in the Receiving array.
You can't. That's why tcp based protocols generally include some sort of end of message dilimiter.
So what you are saying that I'd have to have an intermediate variable to
store & concatenate the incoming data until I see a delimiter?
In article <es**************@tk2msftngp13.phx.gbl>, Frank Rizzo wrote: Tom Shelton wrote: In article <uC**************@TK2MSFTNGP10.phx.gbl>, Frank Rizzo wrote:
Hello, I am having a bit of trouble understanding how tcp/ip works. As a point of reference, with a serial port you essentially get byte by byte in the same order that it was sent out.
With TCP/IP, because it may route individual packets via different paths, does a possibility exist that I will get some packets out of order? Or is this something that is handled by the tcp/ip stack?
TCP guarentees that you will recieve the packets in the order they were sent. UDP on the other hand does not.
Secondly, how can I send tcp/ip data (i.e. length of data) to guarantee that when I call do the following:
byte[] Receiving = new byte[100000]; m_Socket.Receive(Receiving, 0, m_Socket.Available, SocketFlags.None);
that I get everything I sent in one shot. So for instance, if the client sends: "the brown fox jumped over the i can't remember what", I want to be sure that when the server calls the piece of code above, that the entire string is in the Receiving array.
You can't. That's why tcp based protocols generally include some sort of end of message dilimiter.
So what you are saying that I'd have to have an intermediate variable to store & concatenate the incoming data until I see a delimiter?
Yep... Pretty much. I would look at the async socket examples on MSDN.
--
Tom Shelton [MVP]
Tom Shelton wrote: In article <es**************@tk2msftngp13.phx.gbl>, Frank Rizzo wrote:
Tom Shelton wrote: Yep... Pretty much. I would look at the async socket examples on MSDN.
You have a link for me? I keep seeing c++ examples only.
In article <et**************@TK2MSFTNGP15.phx.gbl>, Frank Rizzo wrote: Tom Shelton wrote: In article <es**************@tk2msftngp13.phx.gbl>, Frank Rizzo wrote:
Tom Shelton wrote: Yep... Pretty much. I would look at the async socket examples on MSDN.
You have a link for me? I keep seeing c++ examples only.
You can start here. http://msdn.microsoft.com/library/de...consockets.asp
--
Tom Shelton [MVP] This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andreas Horneff |
last post by:
Hi @ all,
I've got a problem with serial communication in Borland C++ Builder. I've
already found a
lot of stuff about serial communication in the internet, but it dosen't
work.
What I want...
|
by: Peter Krikelis |
last post by:
Hi All,
I am having a problem setting up input mode for serial
communications.
(Sorry about the long code post).
The following code is what I use to set up my comm port.
|
by: K.K. |
last post by:
I am writing program that will recieve or sent data to
selected port (users can select which port they want to
recieve or sent) but I don't know how or whick object I
can use.
|
by: Ben Zhu |
last post by:
I have a small project, which need use both RS232 port and
excel for data plot. I considering use excel VB macro for
the entire project.
Although I used serial port extensively in MFC, I am not...
|
by: David |
last post by:
I am having trouble with "ACCESS DENIED" error messages in a VB.NET 2003
application when attempting to open
serial comms ports.
The application has 2 ports that connect via serial cable to 2...
|
by: Gary Frank |
last post by:
I'd like to write a program in VB.Net that handles serial communications to
several devices. VB.Net 2003 does not have adequate built-in serial
communications. I heard that 2005 will have that. ...
|
by: vicky |
last post by:
Hello,I met a question when I wrote the program.I want the program can
transmit the data frame continuosly through the RS232 when the
communication has been interrupted.But I don't know how to...
|
by: Franklin M. Gauer III |
last post by:
Hi All,
I've written an ASP.NET application (webservice) that does simple serial
communications via the .NET 2.0 SerialComm object.
The application runs fine on my development machine. The...
|
by: LongBow |
last post by:
Hello,
Is there a way, in .NET, to determine what are the avialable Serial
(Communications) Ports on a Windows OS and is there a way to determine
that port isn't being use other than attempting...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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: 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,...
| |