This commit is contained in:
Mark McGranaghan 2012-09-23 17:49:22 -07:00
parent e4b083d49b
commit d7045c962c
49 changed files with 2 additions and 47 deletions

View File

@ -1,13 +0,0 @@
// ## Reading Input
package main
import "fmt"
func main() {
fmt.Print("Enter a number: ")
var input float64
fmt.Scanf("%f", &input)
output := input * 2
fmt.Println(input, "* 2 =", output)
}

View File

@ -1,3 +0,0 @@
$ go run reading-input.go
Enter a number: 7
7 * 2 = 14

View File

@ -1,26 +0,0 @@
// ## TCP Server
package main
import "net"
func main() {
listener, _ := net.Listen("tcp", "0.0.0.0:5000")
for {
conn, _ := listener.Accept()
go Serve(conn)
}
}
func Serve(conn net.Conn) {
buf := make([]byte, 1024)
for {
_, err := conn.Read(buf)
if err != nil {
conn.Close()
return
} else {
conn.Write(buf)
}
}
}

View File

@ -1 +0,0 @@
$ go run tcp-server.go

View File

@ -69,10 +69,11 @@ urls
sha1-hashes
~ base64-encoding
# systems programming
# systems libraries
reading-files
writing-files
~ standard-streams
line-filter
command-line-arguments
command-line-flags
environment-variables
@ -80,9 +81,6 @@ spawning-processes
execing-processes
signals
exit
reading-input
line-filter
tcp server
# client libraries
tcp-client