Saturday, February 23, 2013

Simple Proxy Server using C

35 comments:

  1. Do i need a gcc compiler for this to run ?.i.e shall i run this program and use the executable file to use the proxy ?

    ReplyDelete
  2. First Compile the program and execute the program with port no. as an argument.

    ReplyDelete
  3. Can you please explain what this program actually does? I mean how exactly should you run it in the browser

    ReplyDelete
    Replies
    1. This is a proxy server. Execute the code in a terminal with a specified port. (For eg. for listening to port 10000, run the command ./object_name 10000)
      After this, go to your browser settings and there is option in your browser to set the proxy settings. Give the same port no and the server in which proxy is running.

      Delete
    2. Godly can U tell me please what is the input format ??
      I mean I am done with these steps :
      1. gave object name like ./filename vaue
      2.sites are working
      3. HOW do I check other else paths of code??

      Delete
    3. What do you mean by other else paths?. What you want to do actually?

      Delete
    4. This comment has been removed by the author.

      Delete
  4. What does this proxy server do exactly? I ran it does it just filter out images? That's what I'm getting from this so far.

    ReplyDelete
    Replies
    1. It won't filter out any images. If you run it in a server/pc it'll act as an intermediary for requests from clients. Webpage will be displayed as it is.

      Delete
  5. I changed a few lines to accomomdate POST request and used telnet to test. It works~
    Thank you~

    ReplyDelete
    Replies
    1. do you have a proxy code with POST and HEAD samples too? thanks

      Delete
  6. This essay is very attractive and useful. Your this work defiantly helps other.
    access Monova in UK

    ReplyDelete
  7. Is it hard to implement proxy caching functionality into the server?

    ReplyDelete
    Replies
    1. It can be done easily, just some changes in the server code will do.

      Delete
  8. hey goldy m trying to run it on linux using gcc i am typing ./a.out it just says success.How to exeecute it perfectly?

    ReplyDelete
    Replies
    1. You have to pass the port no as parameter while executing.

      Delete
  9. hey goldy m trying to run it on linux using gcc i am typing ./a.out it just says success.How to exeecute it perfectly?

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Modify this code using parsing and repost it soon.

    ReplyDelete
  13. i ran this code but it wont display anything on firefox browser

    ReplyDelete
  14. *****WELCOME TO PROXY SERVER***** ..the output was just like this ..the website was not opening..please help me nagendra.kovvada@gmail.com

    ReplyDelete
  15. can i use this to filtering the websites

    ReplyDelete
    Replies
    1. Yes, you have to add the conditions for website string comparison or other filter conditions.

      Delete
  16. What should I do after the program started? what condition should I input if I want to access google via the program? Thank You so much!

    ReplyDelete
    Replies
    1. This is program for a proxy server, You can execute program with a port number, so that proxy server will listen to that port number for requests,
      After this, go to your browser settings and there is option in your browser to set the proxy settings. Give the same port no and the server in which proxy is running.
      Then when you make requests in browser for requests, the proxy server will process it.

      Delete
    2. Godly, let's say I compiled it as "test", and run it "./test 10000"... I should change my proxy settings to port no. 10000, right? but what about for the "HTTP Proxy:"? what should I put there? should i put "test"? I'm using mozilla firefox. Thank you very much for your reply.

      Delete
  17. Hi, can I use this as FTP Proxy server?

    ReplyDelete
  18. hey......i just complied this code it is giving me an error on line no 54.the errors are
    p.c:54:60: error: invalid conversion from ‘int*’ to ‘socklen_t* {aka unsigned int*}’ [-fpermissive]
    newsockfd=accept(sockfd,(struct sockaddr*)&cli_addr,&clilen);
    ^
    In file included from p.c:6:0:
    /usr/include/x86_64-linux-gnu/sys/socket.h:243:12: error: initializing argument 3 of ‘int accept(int, sockaddr*, socklen_t*)’ [-fpermissive]
    extern int accept (int __fd, __SOCKADDR_ARG __addr,

    ReplyDelete
  19. ugly code is ugly

    ReplyDelete
  20. Nice post mate, keep up the great work, just shared this with my friendz 1337x

    ReplyDelete
  21. It is my first visit to your blog, and I am very impressed with the articles that you serve. Give adequate knowledge for me. Thank you for sharing useful material. I will be back for the more great post. 1337x

    ReplyDelete