From 7ed4f93dc526811d7f8e602fea7098e108539a42 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Sun, 20 Feb 2022 11:55:11 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20d'un=20manager=20de=20request,=20qui=20?= =?UTF-8?q?re=C3=A7oit=20les=20commandes=20et=20renvoient=20une=20r=C3=A9p?= =?UTF-8?q?onse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/network/ServerUnicast.go | 9 +++++---- pkg/protocol/RequestManager.go | 10 ++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 pkg/protocol/RequestManager.go diff --git a/pkg/network/ServerUnicast.go b/pkg/network/ServerUnicast.go index 3e4c655..f39f53c 100644 --- a/pkg/network/ServerUnicast.go +++ b/pkg/network/ServerUnicast.go @@ -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) } } diff --git a/pkg/protocol/RequestManager.go b/pkg/protocol/RequestManager.go new file mode 100644 index 0000000..47c2ef8 --- /dev/null +++ b/pkg/protocol/RequestManager.go @@ -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 ?) +}