mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-15 12:53:41 +00:00
BitTorrent peer write test
This commit is contained in:
1 parent
41ff983b73
commit
03fbdcda60
15 files changed
+649
-188
No files matched your search
+19
-4
@@ -1,9 +1,24 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var b = -1
|
||||
var n = uint32(b)
|
||||
fmt.Println(n)
|
||||
data := [68]byte{0x13, 0x42, 0x69, 0x74, 0x54, 0x6f, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x05, 0x2c, 0x37, 0xb2, 0x23, 0xe3, 0xaf, 0x73, 0xe7, 0xb0, 0xe7, 0xa0, 0x05, 0x03, 0x07, 0xe6, 0x61, 0xcf, 0x94, 0xe7, 0x0d, 0x2d, 0x55, 0x54, 0x33, 0x35, 0x35, 0x53, 0x2d, 0xaf, 0xb0, 0xec, 0xdc, 0xbf, 0xd1, 0x02, 0x93, 0xd6, 0xf4, 0x9b, 0x24}
|
||||
conn, err := net.Dial("tcp", "58.179.218.77:47474")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
conn.Write(data[:])
|
||||
|
||||
var read [68]byte
|
||||
_, err = io.ReadFull(conn, read[:])
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(read)
|
||||
}
|
||||
Reference in new issue
Block a user