March 28, 2024, 11:30:59 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Proxy Lan server ?

Started by aurelCB, June 06, 2010, 12:23:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aurelCB

I've serch trough forum and dont find anything concrete or i miss something.
So i have two computers ,one is conected to internet and second is connected to first with
LAN cable and i try use some free proxy programs but im not satisfied how works.
Is there any idea how write one simple proxy program or maby someone have example for that?

Aurel

hugh

if the second computer is connected via LAN, is it through a router?
if its not through a router, then i can only assume you have 2 LAN's on first computer.
I am just curious, because both LAN's would have to be ENABLED, and the second computer would also be on the INTERNET.
goto MYCOMPUTER,/My Network places/Microsoft Windows Network/Workgroup
you should be able to see all PC's on your network, there is 4 on my Network, but 2  through a router via lan and 2 wireless, i just double click on 1 of the computer names , type in the computer name and logon password , then i can access that computer.
i can only suggest try, using "System", you give the full path to the computer you wish to connect to.
hope this helps, but i am sure you will get further "more explicit methods"

aurelCB

Hugh
On first computer which is conected to internet i have already installed proxy server.
First i use FreeProxy,then DD proxy programs.Second computer is conected to first with LAN cable
you call them patch or crossover cable.
So i think that maby i can make my own proxy server program which can replace FP DDP,or CCproxy programs.By the way i found one small console proxy called Lite Proxy Server v0.3 but cant put them in
tray.

sapero

If you are using XP Pro, insert your install-cd and install IIS from optional components. If I remember, it includes a proxy server. Be sure to visit later WindowsUpdate :)

From third-party programs, I can recommend proxomitron, a old freeware with url and content filtering. More programs at softpedia :)

IMO why a programmer is looking for software? You should ask how to create, not where to find ;)

aurelCB

June 28, 2010, 03:27:03 PM #4 Last Edit: June 28, 2010, 03:28:36 PM by aurelCB
Heh :)
OK sapero you right...
I ask now how create this type of program?
oh my i already ask on first post:
QuoteIs there any idea how write one simple proxy program or maby someone have example for that?

sapero

Start with a simple TCP server, dump to console all what you receive:

// for nonsecure streams
GET http://www.ionicwind.com/ HTTP/1.0 <newline>
Proxy-Connection: string <newline>
Some-other-header: string <newline>
Content-Length: integer <newline>
<newline>
optional data goes here, Content-Length bytes



GET is sent when you click a link, POST is sent when you submit a form, CONNECT is used to initialize SSL connection.
<newline> is 13,10, or just "\n" in IWBasic.
Headers format (second+ line): name colon space value

End of headers is marked as empty line, so receive until you find "\n\n" in the text. If the first word (always upper case) is POST (instead GET), find "Content-Length", extract the integer after it, and receive Content-Length more bytes. It will be OK if you always lookup the Content-Length header, to see if you have to receive optional data after \n\n.

This is the point your server should parse the text and download remote resource.

So, extract the URL, it will be between the first and second space (do not assume that URL is after GET, because instead GET you may receive POST, CONNECT, or other verbs).
Lenth of URL can be INTERNET_MAX_URL_LENGTH (2084) bytes (protocol+username+password+hostname+path+port), so be prepared!
Http version by default in Internet Explorer is set to 1.0 for proxies, so you will operate with raw, easy to receive, not chunked and not compressed data.

Some pseudo code:
pointer buffer = new(char, 8192)
pointer pos = buffer
int BytesLeft = 8192 - 1 ' room for terminating NULL
BOOL receiving = TRUE
BOOL HeadersCompleted = FALSE

while (receiving)
   int BytesReceived = recv(socket, pos, BytesLeft, 0)
   if (BytesReceived = -1)
      ' exit the loop - network error, connection closed (no more data). Call WSAGetLastError to check what is wrong.
      receiving = FALSE
   else
      pos += BytesReceived
      BytesLeft -= BytesReceived
      *<char>pos = 0 ' optional - cut off trash
   endif

   int nn = instr(*<string>buffer, "\n\n")
   if nn
      HeadersCompleted = TRUE ' here extract the url, find content-length, print to console ...
   endif

   if (!BytesLeft)
      ' todo: resize buffer
   endif
wend


This is the base, and still incomplete schema, just to learn how to start.

aurelCB

Woow thanks Sapero... :)
I have just one question to...
This small server which i currently use LiteProxy(console app) dont need any kind of IP adress he just need open port 8080.
which is really simple...