多路复用流库 Spdystream

码农软件 · 软件分类 · 网络工具包 · 2019-02-25 23:12:26

软件介绍

Spdystream 是使用 spdy 的多路复用流库。

用途示例:

Client example (connecting to mirroring server without auth)

package main

import (
    "fmt"
    "github.com/docker/spdystream"
    "net"
    "net/http"
)

func main() {
    conn, err := net.Dial("tcp", "localhost:8080")
    if err != nil {
        panic(err)
    }
    spdyConn, err := spdystream.NewConnection(conn, false)
    if err != nil {
        panic(err)
    }
    go spdyConn.Serve(spdystream.NoOpStreamHandler)
    stream, err := spdyConn.CreateStream(http.Header{}, nil, false)
    if err != nil {
        panic(err)
    }

    stream.Wait()

    fmt.Fprint(stream, "Writing to stream")

    buf := make([]byte, 25)
    stream.Read(buf)
    fmt.Println(string(buf))

    stream.Close()
}

Server example (mirroring server without auth)

package main

import (
    "github.com/docker/spdystream"
    "net"
)

func main() {
    listener, err := net.Listen("tcp", "localhost:8080")
    if err != nil {
        panic(err)
    }
    for {
        conn, err := listener.Accept()
        if err != nil {
            panic(err)
        }
        spdyConn, err := spdystream.NewConnection(conn, true)
        if err != nil {
            panic(err)
        }
        go spdyConn.Serve(spdystream.MirrorStreamHandler)
    }
}


本文地址:https://www.codercto.com/soft/d/141.html

Rapid Web Applications with TurboGears

Rapid Web Applications with TurboGears

Mark Ramm、Kevin Dangoor、Gigi Sayfan / Prentice Hall PTR / 2006-11-07 / USD 44.99

"Dear PHP, It's over between us. You can keep the kitchen sink, but I want my MVC. With TurboGears, I was able to shed the most heinous FileMaker Pro legacy 'solu-tion' imaginable. It has relationshi......一起来看看 《Rapid Web Applications with TurboGears》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具