Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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

Posted on 2000-04-11
Last Modified: 2010-04-04

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.
Question by:jpvj
LVL 12

Expert Comment

ID: 2706126
As for Q1: Most likely the object has not been created, or it has been freed...



Accepted Solution

jeurk earned 50 total points
ID: 2707036
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...


Expert Comment

ID: 2707150
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


Author Comment

ID: 2709154
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!


Expert Comment

ID: 2709218
listening :-)

Expert Comment

ID: 2710981
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 port 21.

After that, start a client, change th ip to, 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...

Author Comment

ID: 2791628
Hi Again!

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

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

Thanks for your help!


Author Comment

ID: 2883516
Comment accepted as answer

Expert Comment

ID: 2890257
Glad I could help.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

829 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