Browse files

Update the communication chapter

  • Loading branch information...
1 parent 01c67d6 commit bff2b1db1bb91a6d8e8e405943060f6d5d702632 @miekg committed Mar 6, 2011
Showing with 23 additions and 4 deletions.
  1. +1 −0 Changelog
  2. +2 −2 about-miekg.tex
  3. +19 −1 go-communication.tex
  4. +1 −1 go-interfaces.tex
@@ -1,5 +1,6 @@
xx fff 2011: 0.4 Miek Gieben <>
* Fixes
+ * Use hyperref, accurate numbering in the pdf and clickable links
* Functions: callbacks, closures added
* Functions: panic, recover added (TODO)
* Communication: Dial, netchan added (TODO)
@@ -1,4 +1,4 @@
-Miek Gieben has a masters in Computer Science from the Radboud University in Nijmegen.
+Miek Gieben has a master's degree in Computer Science from the Radboud University Nijmegen (Netherlands).
@@ -11,7 +11,7 @@
that actually stuck with him.
He fills his spare time with coding in, and writing of Go. He is the maintainer
-of a Go DNS library: \url{}.
+of the Go DNS library: \url{}.
He maintains a personal blog on \url{} and tweets
under the name \texttt{@miekg}. The postings and tweets may sometimes
@@ -89,10 +89,28 @@ \section{Executing commands}
\func{exit code}, with:
w := os.Wait(pid, os.WNOHANG)
-e := w.WaitStatus.ExitStatus() |\coderemark{ExitStatus() return an integer}|
+e := w.WaitStatus.ExitStatus() |\coderemark{ExitStatus() returns an integer}|
+All network related types and functions can be found in the package \package{net}. One of the
+most important functions in there is \func{Dial}\index{networking!Dial}. When you \func{Dial}
+into a remote system the function returns a \var{Conn} interface type, which can be used
+to send and receive information. The function \func{Dial} neatly abstracts away the network
+family and transport. So IPv4 or IPv6, TCP or UDP can all share a common interface.
+Dialing a remote system (port 80) over TCP, then UDP and lastly TCP over IPv6 looks
+like this:\footnote{In case
+you are wondering, and 2620:0:2d0:200::10 are \url{}.}
+conn, err := Dial("tcp", "", "")
+conn, err := Dial("udp", "", "")
+conn, err := Dial("tcp", "", "[2620:0:2d0:200::10]:80") |\coderemark{Brackets are mandatory}|
+And with \var{conn} you can do read/write \todo{dkls}.
+\todo{Write echo server}
\section{Netchan: networking and channels}
@@ -323,7 +323,7 @@ \section{A sorting example}
\item Write a \emph{generic} Sort function that works on the \type{Sorter} interface.
func Sort(x Sorter) { |\longremark{\var{x} is now of the \texttt{Sorter} type;}|
- for i := 0; i < x.Len()-1; i++ { |\longremark{Using the defined functions, we implement Bubblesort;}|
+ for i := 0; i < x.Len() - 1; i++ { |\longremark{Using the defined functions, we implement Bubblesort.}|
for j := i + 1; j < x.Len(); j++ {
if x.Less(i, j) {
x.Swap(i, j)

0 comments on commit bff2b1d

Please sign in to comment.