starting client/server connection

This commit is contained in:
2020-05-31 18:42:38 -04:00
parent 6ae1705ef0
commit 0051b92c47
9 changed files with 439 additions and 11 deletions

27
client/clientcmd/info.go Normal file
View File

@@ -0,0 +1,27 @@
package clientcmd
import (
"bufio"
"fmt"
"net"
"os"
)
func GetServerInfo(conn *net.Conn) error {
for {
fmt.Println("New LOop")
message, err := bufio.NewReader(*conn).ReadString('\n')
if err != nil {
return fmt.Errorf("error reading from connection: %s", err)
}
fmt.Printf("Message from server: %s", message)
switch message {
case "Connected\n":
fmt.Println("Server has acknowledged connection, asking for server details")
conn.Send(fmt.Fprintf(*conn, "Details\n"))
default:
fmt.Println("Details: ", message)
os.Exit(0)
}
}
}