2-in-1 problem: Stream access and access violation
Posted on 2000-04-11
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.
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'. ...
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!
BTW: If anybody has some Delphi sourcecode for a network tunnel, I would really appreciate it.