Ajout d'un manager de request, qui reçoit les commandes et renvoient une réponse
This commit is contained in:
parent
815da08c8d
commit
7ed4f93dc5
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
10
pkg/protocol/RequestManager.go
Normal file
10
pkg/protocol/RequestManager.go
Normal 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 ?)
|
||||
}
|
Loading…
Reference in New Issue
Block a user