FAQ
I've implemented a TCP server with the following code structure from here:
http://golang.org/pkg/net/#example_Listener

I'm trying to ping the TCP server from a browser. The TCP server is able to
write to my browser. However, it is not able to write to the client header
as it is not using the HTTP protocol. How do I keep the TCP protocol and
connections but still be able to write to the browser's header?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Svip at Oct 25, 2014 at 7:04 am

    On 25 October 2014 09:02, Audrey Lim wrote:
    How do I keep the TCP protocol and connections but still be able to write to
    the browser's header?
    By using HTTP? HTTP is a layer over TCP.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Audrey Lim at Oct 25, 2014 at 7:07 am
    Yea.. how do I keep the code for

    l, err := net.Listen("tcp", ":2000")
    ...

    and write to header with http later on?
    On Saturday, October 25, 2014 3:04:22 PM UTC+8, Svip Pong wrote:

    On 25 October 2014 09:02, Audrey Lim <audr...@gmail.com <javascript:>>
    wrote:
    How do I keep the TCP protocol and connections but still be able to write to
    the browser's header?
    By using HTTP? HTTP is a layer over TCP.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Svip at Oct 25, 2014 at 7:11 am

    On 25 October 2014 09:06, Audrey Lim wrote:
    Yea.. how do I keep the code for

    l, err := net.Listen("tcp", ":2000")
    ...

    and write to header with http later on?
    I haven't created a TCP-listener myself, just yet, so I am not
    entirely sure how to write to its body, but I am certain you can write
    to a TCP-connection's body. But since you are basically doing a HTTP
    connection yourself, you must remember the whole HTTP header.

    But is there a reason to use a TCP-listener rather than a HTTP-listener?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • James Bardin at Oct 25, 2014 at 11:16 am
    An HTTP listener is aTCP listener.

    You can just hand a net.Listener to http.Server.Serve

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 25, '14 at 7:02a
activeOct 25, '14 at 11:16a
posts5
users3
websitegolang.org

3 users in discussion

Audrey Lim: 2 posts Svip: 2 posts James Bardin: 1 post

People

Translate

site design / logo © 2022 Grokbase