Commits

Cédric Bonhomme  committed 189177c

Display the address ad port where the server is waiting.

  • Participants
  • Parent commits 03ba8a0

Comments (0)

Files changed (1)

 package main
 
-
 import (
         "fmt"
         "net"
         "flag"
 )
 
-
 // Represent a client
 type Client struct {
     Name string
     ClientList *list.List // pointer to the "global" list of all connected clients
 }
 
-
 func (c *Client) Read(buffer []byte) bool {
     bytesRead, error := c.Conn.Read(buffer)
     if error != nil {
     return true
 }
 
-
 func (c *Client) Close() {
     c.Quit <- true
     c.Conn.Close()
     c.RemoveMe()
 }
 
-
 func (c *Client) Equal(other *Client) bool {
     if bytes.Equal([]byte(c.Name), []byte(other.Name)) {
         if c.Conn == other.Conn {
     }
 }
 
-
 func Log(v ...interface{}) {
     fmt.Println(v...)
 }
     }
 }
 
-
 func ClientReader(client *Client) {
     buffer := make([]byte, 2048)
 
     Log("ClientReader stopped for ", client.Name)
 }
 
-
 func ClientSender(client *Client) {
     for {
         select {
     }
 }
 
-
 func ClientHandler(conn net.Conn, ch chan string, clientList *list.List) {
     buffer := make([]byte, 1024)
     bytesRead, error := conn.Read(buffer)
             defer netListen.Close()
 
             for {
-                Log("Waiting for clients on " + port  + "...")
+                Log("Waiting for clients on " + service)
                 connection, error := netListen.Accept()
                 if error != nil {
                     Log("Client error: ", error)