Results 1 to 7 of 7

Thread: [2005] TcpListener or HttpListener?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091

    [2005] TcpListener or HttpListener?

    When developing a custom server, and that server needs to be installed inside a network that only allows incoming requests from outside the network using port 80/http, would this force me to use the HttpListener class to build my server on? I gather I could set my TcpListener to monitor port 80, but I do know that most firewalls/proxys are smart enough to know if the incoming request is wrapped in appropriate http code, even though it's on port 80.

    I don't need the overhead of http since it's not a "web" app, but I have to consider the possibility of inbound requests over port 80/http.

    Any advice would be appreciated.

    Visual Studio 2010

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] TcpListener or HttpListener?

    Any of the two will do, but I'd go for HttpListener as its specifically made for this purpose.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091

    Re: [2005] TcpListener or HttpListener?

    Great. So just to be sure, even though this app will not be accessed via a web page, but rather a custom designed client, as long as the client is submitting "http" requests it should work? Just for some brief info, the client app will be submitting custom package of data for which the server will act on once received. Sorta like a zipped file from the client but sent through as an http post.

    Visual Studio 2010

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] TcpListener or HttpListener?

    Aha, so you're not going to send an HTTP request to the listener? In that case I'm not sure if the HttpListener will work for you. I havent used it personally but I think it relies on receiving proper HTTP requests.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091

    Re: [2005] TcpListener or HttpListener?

    Well, from the client, if I use the HTTPRequest class and "post" a properly formatted http message, it should go through the firewall. However, is there a way to "post" a file with the HTTPRequest class?? I guess it would be comparable to uploading a file via http.

    Visual Studio 2010

  6. #6
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] TcpListener or HttpListener?

    Yeah just read the file as binary and send the binary data in the body of the http request. Set the content-type header to the appropriate mime type if needed.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091

    Re: [2005] TcpListener or HttpListener?

    Sweet! Sounds real promising. I see you have some great code on here for the TCP class, but I wonder how easily adopted it is to the HTTP class???

    Visual Studio 2010

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width