Skip to content

runtime: Mac OS socket problem #12679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
deepch opened this issue Sep 18, 2015 · 2 comments
Closed

runtime: Mac OS socket problem #12679

deepch opened this issue Sep 18, 2015 · 2 comments

Comments

@deepch
Copy link

deepch commented Sep 18, 2015

If the socket is busy reading the flow of the other operations are not performed . This Problem is, only mac os.

Dine sample code should write

fmt.Println ("byte")

but wrote in mac os X

At the same time in linux there is not any problems undelivered code .

It seems to me that the b, _: = conn2.Read (data2) blocks the flow in the mac os X but does not do it in linux

package main

import (
    "fmt"
    "net"
)

var i = make(chan []byte)
var is = make(chan []byte)

func main() {
    go ch_reader()
    conn2, _ := net.Dial("tcp", "171.25.235.18:554")
    data := make([]byte, 8196)
    for {
        conn2.Write([]byte("DESCRIBE rtsp://171.25.235.18:554/mpeg4 RTSP/1.0\r\nCSeq: 1\r\n\r\n"))

        n, _ := conn2.Read(data)

        fmt.Println(string(data[:n]))
        conn2.Write([]byte("SETUP rtsp://171.25.235.18:554/mpeg4 RTSP/1.0\r\nCSeq: 1\r\nTransport: RTP/AVP/TCP;interleaved=0-1\r\n\r\n"))

        d, _ := conn2.Read(data)

        fmt.Println(string(data[:d]))
        conn2.Write([]byte("PLAY rtsp://171.25.235.18:554/mpeg4 RTSP/1.0\r\nCSeq: 1\r\n\r\n"))

        r, _ := conn2.Read(data)

        fmt.Println(string(data[:r]))
        data2 := make([]byte, 8196)
        for {
            b, _ := conn2.Read(data2)
            i <- data2[:b]

        }
        break
    }
}

func ch_reader() {
    for {
        fmt.Println("byte")
        req := <-i
        is <- req

    }
}
@ianlancetaylor
Copy link
Member

Your program does not make sense, since nothing ever reads from the channel "is". Your ch_reader function is going to stop after printing "byte" once.

What do you see on Mac OS, and what you do expect to see?

@ianlancetaylor ianlancetaylor changed the title Mac OS socket problem runtime: Mac OS socket problem Sep 18, 2015
@rsc
Copy link
Contributor

rsc commented Oct 23, 2015

Timed out.

@rsc rsc closed this as completed Oct 23, 2015
@golang golang locked and limited conversation to collaborators Oct 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants