dnssecsocket/client/client.go

35 lines
620 B
Go

package main
import "net"
import "fmt"
import "bufio"
import "os"
const (
CONN_HOST = "fire.lab.wit.com"
CONN_PORT = "3333"
CONN_PROTO = "tcp"
)
func main() {
// connect to this socket
conn, _ := net.Dial(CONN_PROTO, CONN_HOST+":"+CONN_PORT)
// read in input from stdin
reader := bufio.NewReader(os.Stdin)
fmt.Fprintf(conn,"librem15.lab.wit.com\n")
for {
fmt.Print("Text to send: ")
text, _ := reader.ReadString('\n')
// send to socket
fmt.Fprintf(conn, text + "\n")
// listen for reply
message, _ := bufio.NewReader(conn).ReadString('\n')
fmt.Print("Message from server: "+message)
}
}