Login  
Search All Forums
Dart Home | PowerTCP Sockets for .NET | Custom Development Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
AuthorForum: PowerTCP Sockets for .NET (Secure and Standard)
Topic: Tcp.Receive() not functioning properly.
abalij

From: Mississauga, ON Canada
Posts: 3
Member Since: 09/29/03
posted September 29, 2003 1:17 AM

Hello

I am writing a software that works identically to a browser. The issue I have is when I receive (with SSL stream) a web page that is chunked.

The receive function first of all, does not work at all for the option Peek. When I say does not work, I mean it blocks the thread, and sits waiting for incoming data.

The next problem is when I receive a web page that has been splitten up into chunks. I can receive the header fine, no problems, the first chunk of the web page is received correctly, the next chunk after that, Receive() stops working(blocks thread, etc etc).

So, one solution I found around it is to receive byte by byte until the whole web page arrived. Ofcourse, it was slow and unreliable and did not meet my demands. This boggled my mind though that I can receive byte by byte, but when I try to receive a larger amount, ie: 8192 bytes, the first chunk comes in fine, but the second one doesnt. It acts as if it was waiting for data.

So, I again found another solution, here is the pseudo code(my best attempt):

ChunkSize = GetNextChunkSize
do while ChunkSize <> 0
 Chunk = Receive(1 byte)
 chunk = chunk & receive(ChunkSize-1)
 ChunkSize = GetNextChunkSize
loop

Unfortunately, it's not how I wanted it to be, but I can deal with it. But it still does not receive as fast I would like. It seems to take a GOOD 3-4 seconds for it to receive the first byte (Chunk = Receive(1 byte)).

Again, this is with the SSL stream. Funny thing is this problem only occurs with receiving chunked web pages, and from an Apache server. It can receive everything else. It all works fine with other servers. I also have purscased this product recently so I do have the latest version.

- Adrian
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted September 29, 2003 8:47 AM

The following program can be used to save a url:

http://support.dart.com/downloads/SaveUrl.zip

Please download it and try it. If you have a url that does not work, please supply it so that I can try it here.
abalij

From: Mississauga, ON Canada
Posts: 3
Member Since: 09/29/03
posted September 30, 2003 10:20 AM

Hi Tony

I downloaded the SaveUrl program and it doesn't work properly at all. It receives the header correctly, but it does not receive anything at all afterwards.

Some things I did have to change with the SaveUrl program is that I had to create an SSL stream object (using ssl3, disabling authentication) just so that the program can connect to the server.

Dim Browser As New Tcp
Dim Ssl As New SslStream(New TcpStream(Browser))
Browser.Stream = New SegmentedStream(Ssl)
Ssl.useAuthentication = False
Ssl.Protocol = SecureProtocol.SSL3

If you would like to check yourself, the address is: https://n103.tsi.bc.ca/Login.jsp

Please note, that the server seems to be case sensitive with the web pages. I noticed that SaveUrl would change the page requested to all lower case and the server would return a 404 error.

- Adrian
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted September 30, 2003 11:37 AM

When did you last download a setup? I just used the shipping DLL's and the only modification I had to make was to comment out the line about "UseAuthentication" and then make the Tcp object global withevents so that I could override the CertificateReceived event to accept your untrusted certificate.

After that I got a page that 4,007 bytes that appeared to be complete.

Try downloading the latest setup from our website and try again.

abalij

From: Mississauga, ON Canada
Posts: 3
Member Since: 09/29/03
posted September 30, 2003 12:52 PM

Hi Tony, I downloaded the latest setup (SSL sockets.net 1.0.3) and I tried again. I had received the same problem where it receives the header correctly, but the 4007 byte array it was suppose to receive turned out to be all 0s.

I tried making the tcp object global/withevents and without yet it yields the same results.

- Adrian
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted September 30, 2003 12:58 PM

I'm going to send you some files via email in a few minutes. We'll continue this off the forum.

Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX