Ajout d'un manager de request, qui reçoit les commandes et renvoient une réponse

This commit is contained in:
Benjamin Lejeune 2022-02-20 11:55:11 +01:00
parent 815da08c8d
commit 7ed4f93dc5
2 changed files with 15 additions and 4 deletions

View File

@ -1,14 +1,16 @@
package network
import (
"_StorBackEnd/pkg/protocol"
"bufio"
"fmt"
"net"
)
type ServerUnicast struct {
Network string
Address string
Network string
Address string
ReqManager protocol.RequestManager
}
func (server ServerUnicast) Run() {
@ -27,13 +29,12 @@ func (server ServerUnicast) Run() {
fmt.Printf("Error while accepting client : %s\n", err)
return
} else {
line, err := bufio.NewReader(con).ReadString('\n')
if err != nil {
return
}
fmt.Printf("MESSAGE : %s\n", line)
server.ReqManager.Execute(line)
}
}

View File

@ -0,0 +1,10 @@
package protocol
type RequestManager struct {
}
func (receiver RequestManager) Execute(request string) {
// On lis ce que l'on reçoit
// On renvoie la réponse (Comment pour fichier ?)
}