mirror of
https://github.com/go-i2p/go-i2cp.git
synced 2025-07-04 02:04:41 -04:00
Working on getting sessions functional
This commit is contained in:
35
tcp.go
Normal file
35
tcp.go
Normal file
@ -0,0 +1,35 @@
|
||||
package go_i2cp
|
||||
|
||||
import "net"
|
||||
|
||||
func tcpInit() {
|
||||
address = net.TCPAddr{
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
Port: 7654,
|
||||
}
|
||||
}
|
||||
|
||||
func tcpDeinit() {
|
||||
|
||||
}
|
||||
|
||||
var address net.TCPAddr
|
||||
var conn *net.TCPConn
|
||||
|
||||
func (tcp *Tcp) Connect() (err error) {
|
||||
conn, err = net.DialTCP("tcp", nil, &address )
|
||||
return
|
||||
}
|
||||
|
||||
func (tcp *Tcp) Send(buf *Stream) (i int, err error) {
|
||||
i, err = conn.Write(buf.Bytes())
|
||||
return
|
||||
}
|
||||
|
||||
func (tcp *Tcp) Receive(buf *Stream) (i int, err error) {
|
||||
i, err = conn.Read(buf.Bytes())
|
||||
}
|
||||
|
||||
type Tcp struct {
|
||||
|
||||
}
|
Reference in New Issue
Block a user