Changement pour n'accepter qu'un seul client
This commit is contained in:
parent
f58890ead1
commit
815da08c8d
13
cmd/main.go
13
cmd/main.go
@ -5,19 +5,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MULTICAST_ADDRESS = "226.0.0.1:42500"
|
MULTICAST_ADDRESS = "226.66.66.1:42500"
|
||||||
MULTICAST_SECOND = 10
|
MULTICAST_SECOND = 10 // TODO : Changer en 30 secondes
|
||||||
|
UNICAST_ADDRESS = "0.0.0.0:58000"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
println("StorBackEnd started !")
|
println("StorBackEnd started !")
|
||||||
|
|
||||||
//multicast := network.CreateClientMulticast(MULTICAST_ADDRESS, MULTICAST_SECOND)
|
multicast := network.CreateClientMulticast(MULTICAST_ADDRESS, MULTICAST_SECOND)
|
||||||
|
go multicast.Run()
|
||||||
|
|
||||||
/* go */
|
server := network.ServerUnicast{Network: "tcp", Address: UNICAST_ADDRESS}
|
||||||
//multicast.Run()
|
|
||||||
|
|
||||||
server := network.ServerUnicast{Network: "tcp", Address: "0.0.0.0:58000"}
|
|
||||||
server.Run()
|
server.Run()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,23 +20,20 @@ func (server ServerUnicast) Run() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// go serverConsole(&cManager)
|
// Attente connexion du FileFrontEnd
|
||||||
|
con, err := listen.Accept()
|
||||||
|
|
||||||
for {
|
if err != nil {
|
||||||
con, err := listen.Accept()
|
fmt.Printf("Error while accepting client : %s\n", err)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
|
||||||
|
line, err := bufio.NewReader(con).ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error while accepting client : %s\n", err)
|
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
line, err := bufio.NewReader(con).ReadString('\n')
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("MESSAGE : %s\n", line)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("MESSAGE : %s\n", line)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user