Dear Friends,
I'm working on real time stock quotes display. Using Async tcp sockets
in .net csharp. Client software running perfect on LAN and ISDN but not
good on ip dialup. After lot of testing i found the result is, I'm
sending packet by packet data to client socket but client receiving
stream read all packets at once.
Can i reduce the tcp window size in .net or any method i can use to
bound client get packet by packet data.
Please reply, its urgent I really appreciate.
Thanks,
-mak 5 2949
You can not control the packets sent over the network, think in terms of
streams. So, this is a typical boundary problem of sockets. There are 3
solutions to this problem:
1) Use packets of fixed size
2) Include the (variable) size in each packet
3) Use a delimiter to separate packets
With any of those approaches the receiver will know to separate the messages
from the stream.
Details and samples are provided in the following book:
C# Network Programming http://www.amazon.com/exec/obidos/tg...40812?v=glance
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers: http://www.mztools.com
"mak" <mo********@hot mail.com> escribió en el mensaje
news:11******** **************@ g47g2000cwa.goo glegroups.com.. . Dear Friends,
I'm working on real time stock quotes display. Using Async tcp sockets in .net csharp. Client software running perfect on LAN and ISDN but not good on ip dialup. After lot of testing i found the result is, I'm sending packet by packet data to client socket but client receiving stream read all packets at once.
Can i reduce the tcp window size in .net or any method i can use to bound client get packet by packet data.
Please reply, its urgent I really appreciate.
Thanks,
-mak
Hi all,
I am also facing the same problem as stated by Mak, and I have
implemented Carlos's suggestion.
But the problem is the number of bytes received by the asynchronous
socket is not exact multiple of the piecesize as I had anticipated.
For example-
lets assume the piece size is 8000Bytes.
But the listener socket data receives any amount of data from 0 to the
buffer size it is provided with.My buffer size for the testing case
was 33000Bytes.
And the data it received was like-25876 Bytes,26420 Bytes,sometimes
33000bytes.
I am at the end of my wits what is happening here.
Any kind of help will be deeply appreciated.
Thank you all.
Sorry not to mention it in my previous post:
As the number of bytes received is not exact multiple of (piecesize +
delimiter) how am I going to know what the bytes received contains and
what to do with it.
to make it a bit clear what is happening is:
pppp:for a piece, dd for a delimiter, so ppppdd makes one piece.
but what i get at the listener end issomething like ppppddppppddpp or
something like it. So at the end I dont know how to deal with the
fractured pieces at the end and also the fractured piece that will be
received next at the listener.
Thanks.
"just_start ing" <ju***********@ gmail.com> wrote in news:1121351626 .287858.266720
@o13g2000cwo.go oglegroups.com: But the problem is the number of bytes received by the asynchronous socket is not exact multiple of the piecesize as I had anticipated.
And it never will be - thats how sockets work, and in fact most network transports.
And the data it received was like-25876 Bytes,26420 Bytes,sometimes 33000bytes.
I am at the end of my wits what is happening here.
You will receive whatever the network happens to see at that time. You have to reassemble it.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"
Develop ASP.NET applications easier and in less time: http://www.atozed.com/IntraWeb/
It is streaming, dude, the implication is you don't know how much a get
receives. It is your own protocol that makes sense of the stream of bytes so
you need to buffer, determine begin and end and then do whatever you want to
do with it.
"just_start ing" <ju***********@ gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Sorry not to mention it in my previous post:
As the number of bytes received is not exact multiple of (piecesize + delimiter) how am I going to know what the bytes received contains and what to do with it.
to make it a bit clear what is happening is:
pppp:for a piece, dd for a delimiter, so ppppdd makes one piece.
but what i get at the listener end issomething like ppppddppppddpp or something like it. So at the end I dont know how to deal with the fractured pieces at the end and also the fractured piece that will be received next at the listener.
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ben |
last post by:
I've written a fair amount of sockets code using the Winsock2 API, but I am having some trouble converting to the .Net Sockets API, specifically asynchronous sockets.
What I have is a form that is both a client and a server. When the form starts I create a listening socket and call Socket.BeginAccept(). When a client connects my accept function is called, and it is on a separate thread. After I accept the client connection I connect to...
|
by: David |
last post by:
Hi,
Ive been trying to work this out for the past 2 days now and im not
getting anywhere fast.
The problem i have is that i am using Asynchronous sockets to create a
Socket Client library. When i try to connect to a server that doesnt
exist it raises a "Connection forcibly rejected by the resmote host"
SocketException.
|
by: Trevor |
last post by:
Does the async. sockets implementation in .NET use IO Completion Ports
(IOCP) internally or would I have to use P/Invoke to use IOCP in a C#
async. socket server?
|
by: whizpop |
last post by:
Hi,
First of all, thanks for a great starter kit, now If I could just get
it to work (fully).
I am trying to compile and run the solution/services all on a local dev
box.
I am able to successfully run most of the SampleApp features
(Register,Feedback,Error report, version check)
The only method I can not execute is the BuyNow example.
I have tried leveraging the Sharewarestarterkit.com web service to rule
out locality, to no avail.
|
by: Dinsdale |
last post by:
I am trying to write a Tcp "Server" that opens a class that wraps a tcp
socket when a new connection is made (Listener.AcceptSocket()).
Everything is going swimmingly except when I try to close the socket
during a read and I get the following error:
<error_msg>
An unhandled exception of type 'System.Net.Sockets.SocketException'
occurred in system.dll
Additional information: The I/O operation has been aborted because of
| |
by: Greg Young |
last post by:
Ok so I think everyone can agree that creating buffers on the fly in
an async socket server is bad ... there is alot of literature
available on the problems this will cause with the heap. I am looking
at a few options to get around this.
1) Have a BufferPool class that hands out ArraySegment<byteportions
of a larger array (large enough that it would be in the LOH). If all
of the array is used create another big segment.
2) Create a...
|
by: nyhetsgrupper |
last post by:
Hi,
I've written a async server app. This app start by connecting to a
client and then send some data (BeginSend). When the data is sent, the
server is starting to listen for incomming data. (BeginRecieve). In the
receive callback I always call BeginRecieve again to keep listen for
more data. The server is continualy listening, and from time to time
sending (but if it is sending more data when there is already a
listening socket, I don't...
|
by: nyhetsgrupper |
last post by:
I'm writing a server application connection to multiple clients using
sockets. I want one socket for each client, and the comunication needs
to be async. I could use the async sockets methods (beginsend,
beginrecv...) or I could start a new thread for each client and run the
comunication using the sync mehtods (send,recv). What is the best
aproach? This is a performance critical application.
|
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: Ryan Liu |
last post by:
Hi,
I have a 100 clients/ one server application, use ugly one thread pre client
approach. And both side user sync I/O.
I frequently see the error on server side(client side code is same, but I
don't see the error):
"System.IO.IOException: Unable to read data from the transport connection:A
blocking operation was interrupted by a call to WSACancelBlockingCall"
|
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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |