Preparing all basic files
This commit is contained in:
parent
6b540e88c0
commit
fc50027b39
|
@ -0,0 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Sample text")
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
func server() {
|
||||
|
||||
}
|
||||
|
||||
func getIP(conn net.Conn) (address *net.TCPAddr) {
|
||||
if addr, ok := conn.RemoteAddr().(*net.TCPAddr); ok {
|
||||
return addr
|
||||
//fmt.Printf("Received connection from: %v\n", addr)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func handleConn(conn net.Conn) {
|
||||
fmt.Println()
|
||||
address := getIP(conn)
|
||||
fmt.Printf("%v connected!\n", address)
|
||||
}
|
Loading…
Reference in New Issue