30 lines
557 B
Go
30 lines
557 B
Go
package server
|
|
|
|
import (
|
|
_ "PD1/internal/utils/cryptoUtils"
|
|
_ "PD1/internal/utils/networking"
|
|
"fmt"
|
|
"net"
|
|
)
|
|
|
|
func clientHandler(conn net.Conn) {
|
|
|
|
}
|
|
|
|
func Run(port int) {
|
|
ip, err := net.ResolveTCPAddr("tcp", ":8080")
|
|
if err != nil {
|
|
panic("Server could not bind to address")
|
|
}
|
|
listener, err := net.ListenTCP("tcp", ip)
|
|
if err != nil {
|
|
panic("Server could not listen on address")
|
|
}
|
|
for {
|
|
conn, err := listener.Accept()
|
|
if err!=nil{
|
|
panic("Server could not accept connection")
|
|
}
|
|
go clientHandler(conn)
|
|
}
|
|
}
|