delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback



Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi








Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (1)


Quick BNCGo to Lloyd Kinsella's websiteFormat this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi all versions
Category:
Internet / Web
Skill Level:
Scoring:
Last Update:
11/29/2001
Search Keys:
delphi delphi3000 article borland vcl code-snippet internet irc bnc tcp/ip http ftp nntp msn yahoo aol bounce jump proxy icq ports
Times Scored:
7
Visits:
4993
Uploader: Lloyd Kinsella
Company: Workshell Inc
Reference: www.workshell.co.uk
 
Question/Problem/Abstract:
How do you do BNC for IRC and other TCP/IP protocols?
Answer:



How do you do BNC for IRC? Well my method is quick and simple, its not perfect but it'll get the job done, and it "could" be used on anything not just IRC but also HTTP, FTP, MSN Messenger, Yahoo Messenger, AOL Messenger, ICQ and more!

Firstly BNC basically is a bouncing method, much like a proxy, you connect from your local machine to a remove bounce machine which then passes data on further to the final destination.

This article assumes you have Delphi and TServerSocket, TClientSocket components - the principals however can be applied to other TCP/IP socket components.

1) Create a new application, blank form et al.

2) Drop 1 TServerSocket component on the form and 1 TClientSocket component on the form.

3) Set the TServerSocket port and the TClientSocket port to 6667. Set the TClientSocket host to lineone.uk.eu.dal.net.

4) In the OnRead event of the TClientSocket create the following code:

procedure ClientSocketRead(Sender: TObject; Socket: TCustomWinSocket);
var
Data: String;
I: Integer;
begin
Data := Socket.ReceiveText;
  for I := 0 to ServerSocket.Socket.ActiveConnections do
   ServerSocket.Socket.Connections[I].SendText(Data);
end;

5) In the OnClientRead event of the TServerSocket create the following code:

procedure ServerSocketClientRead(Sender: TObject; Socket: TCustomWinSocket);
var
Data: String;
begin
Data := Socket.ReceiveText;
ClientSocket.Socket.SendText(Data);
end;

6) On the Form's OnCreate put the following code:

procedure FormCreate(Sender: TObject);
begin
ServerSocket.Open;
ClientSocket.Open;
end;

7) On the Form's OnDestroy put the following code:

procedure FormDestroy(Sender: TObject);
begin
ServerSocket.Close;
ClientSocket.Close;
end;

Compile and run. Once running quickly launch for example mIRC, type:

/server localhost 6667

It will then route via the BNC to the IRC server.

You can put the BNC anywhere!

Of course this is only a rough job, real BNC stays alive when you disconnect your client (this one sort of will) and knows when you rejoin etc. This can also be extended to cover HTTP proxy etc.

Enjoy!





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
What is BNC?
    Doug Chamberlin (Nov 29 2001 5:37AM)

Somewhere in the article you should have explained what it was about.
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


   


  Community Ad of
R. Lefter
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)