Login  
Search All Forums
Dart Home | PowerTCP Telnet for .NET | Custom Development Reply | PowerTCP Telnet for .NET Topics | Forums   
AuthorForum: PowerTCP Telnet for .NET
Topic: How to receive more than 2^13 characters
mhenne

From: Luxembourg
Posts: 1
Member Since: 10/16/15
posted October 16, 2015 1:55 AM

Hi Dart,
by doing the following

Public Function Telnet_Receive() As String
  Dim s As String
  Dim x As Long

  Sheet1.Telnet1.Receive s
  Telnet_Receive = s
  x = Len(s)
End Function

the maximum length of the received string is always 8192 characters. Is it possible to increase the buffer size of the received string, so that I can receiver more than 8192 characters in one go? If yes, how can I do this?

Further on, by doing a workaround with a DO...WHILE loop as shown below, I am receiving more than 2^13 characters, but unfortunately not always. The Telnet ActiveX element receives very often just 3752 characters. The outcome is random, but I can reproduce that behavior.
  Do                        
 response = Telnet_Receive()
 ans = ans & response
Loop While Len(response) = 8192 


Public Function Telnet_Receive() As String

  Dim s As String
  Dim x As Long
    
  Sheet1.Telnet1.timeout = 5000
  Sheet1.Telnet1.Receive s
  Telnet_Receive = s

End Function


Marc

Mike Baldwin (Admin)



From: Rome, NY USA
Posts: 114
Member Since: 04/11/00

Extra Support Options
Custom Application Development

posted October 20, 2015 3:47 PM

Hi Marc,

The Telnet control queries the socket to see how much data can be read at once, dynamically creates an array of that size, then returns that data into the String parameter you provided. This is controlled by the size of the socket receive window, which defaults to 8K (as you observed). I believe there is a registry entry that can change this default value:

[HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services \Afd \Parameters]
DefaultReceiveWindow = 16384
DefaultSendWindow = 16384

There is also a Telnet.Socket property that can be used for making a WIN32 call to setsockopt() to change the default size. I'd send you a snippet if I had one, but I'm sure there are resources on the web you can find.

In general, you never know how much data is available when your code calls Telnet.Receive (because issues like network speeds, equipment, and latency come into play), but it sounds like you're moving a lot of data and I can see why you might want to increase the buffer size.

If you get stuck, please call us and we can provide an hour or 2 of consulting to get you on your way. Happy coding, and thanks for using our products.

Kind Regards,
Mike

------
-Non-current subscribers must contact sales@dart.com to update subscription and receive continued support as needed.
------

Reply | PowerTCP Telnet for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX