#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    41
    Rep Power
    12

    Proxy server in C


    Hi there,

    Ok, I have a problem here. I have just started working on an assignment with socket programming in C, and I dont quite understand how this whole thing works.

    we suppose to build a proxy server that will take the commands from the client and pass it on to the psql server for further operations.

    Does that mean I have to first connect to the proxy server, then once connected, I (client) can start typing in psql commands, thus, the proxy will pass them to the psql server and the psql server will pass them back to the proxy and then to the client????

    Help......................
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,161
    Rep Power
    2222
    Yeah, looks like you have the right idea.

    I did something similar in my first serious project. I needed to write an embedded telnet client (ie, add telnet-client capability to an existing test application), so I first wrote MiM ("man in the middle") with which I wanted to capture the negotiating that goes on at the beginning of a telnet session in order to understand what my embedded client would have to do.

    In effect, MiM was both a server and and client; its server side listened for our client to connect, whereupon it would start its client side to connect to the actual server. Then basically one side would receive a packet and pass it to the other side who would then send it. And when the client disconnected, MiM would disconnect from the actual server. If there is any extra functionality needed (eg, MiM would log each packet's contents to a disk file, a proxy server may cache or filter the packet), then it can easily be added.

IMN logo majestic logo threadwatch logo seochat tools logo