Solved

2-in-1 problem: Stream access and access violation

Posted on 2000-04-11
9
288 Views
Last Modified: 2010-04-04
Hi!

I'm trying to write a HTTP tunnel. My idea is to let a browser connect to a blocking serversocket, and administrate all data from the browser to the host in the thread, that is beeing spawned.

In the thread, I create a new TThread. This thread will then manage all responses from the proxy/HTTP server back to the browser.

(1)
In the TServerClientThread I create a new blocking socket (to connect to the HTTP/proxy server), but sometimes i get an access violation the setting Active:=True. Why?

Error is: Project nnnn raised exception class EAccessViolation with message 'Access Violation at address C000013C. Read of address C000013C'. ...

I also get '... 'Access Violation at address 00000000. Read of address 00000000'. ...

(2)
In the TServerClientThread I also create two WinSocketStream. One is beeing read from the TServerClientThread (HTTP requests) and written from the TThread (Answers from the HTTP/proxy server), and the other Stream works the otherway around.

Is this ok to do, without making any kind of mutual exclution? If not - how should this be done?
(I have not had any errors so far, but ...)

Hope to hear from you soon guys!

Peter

BTW: If anybody has some Delphi sourcecode for a network tunnel, I would really appreciate it.
0
Comment
Question by:jpvj
9 Comments
 
LVL 12

Expert Comment

by:rwilson032697
Comment Utility
As for Q1: Most likely the object has not been created, or it has been freed...

Cheers,

Raymond.
0
 
LVL 4

Accepted Solution

by:
jeurk earned 50 total points
Comment Utility
Hello,
I suggest you take a look at the winshoes components.
They have the components you need :
tunnel master, and tunnel slave. they
is also a demo that show how to use things.
Get them on http://www.pbe.com/Winshoes
it's free and open source...

Let me know, if they is a problem...

-Jk
0
 
LVL 2

Expert Comment

by:PeterLarsen
Comment Utility
I have done something similar to what you want, but i found it was easier to use NonBlocking.
Regarding Q1 : I'm using TServerSocket (NonBlocking) and i remember that some "socket.close" commands actually close all open treads. Maybe something similar happen in your program.

Good luck
Peter
0
 

Author Comment

by:jpvj
Comment Utility
To Jeurk:

Hi again!

The Winshoes package looks very impressing, except for the (lack of) documentation!

Could you please explain, how the tunnel demo works?

Thanks in advance!

Peter
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 5

Expert Comment

by:Gwena
Comment Utility
listening :-)
0
 
LVL 4

Expert Comment

by:jeurk
Comment Utility
Hello,
Where is a lack documentation ? ;)
ok. I agree.
This so well written that you don't need documentation.
You was trying to do some tunneling stuff, so you should understand what is going on ? no ?
To make the demo work : launch the server...
he will start to listen on host 127.0.0.1 port 21.

After that, start a client, change th ip to 127.0.0.1, start it. The serveur will show you a connexion.
You cannot start more then on client on the same machine.

This how to do it the hard way. If you look at the components, you will see that they is a TMasterTunnel and a TSlaveTunnel.
They encapsulate all the fonctions you need...
0
 

Author Comment

by:jpvj
Comment Utility
Hi Again!

Sorry for the long delay, but ... :-)

If have use the WinshoeMappedPort instead, and it work fine!

Thanks for your help!

Peter
0
 

Author Comment

by:jpvj
Comment Utility
Comment accepted as answer
0
 
LVL 4

Expert Comment

by:jeurk
Comment Utility
Glad I could help.
CU
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now