Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update the communication chapter

  • Loading branch information...
commit bff2b1db1bb91a6d8e8e405943060f6d5d702632 1 parent 01c67d6
@miekg miekg authored
View
1  Changelog
@@ -1,5 +1,6 @@
xx fff 2011: 0.4 Miek Gieben <miek@miek.nl>
* 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)
View
4 about-miekg.tex
@@ -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).
\begin{wrapfigure}{r}{0.3\textwidth}
\begin{center}
\includegraphics[width=3cm]{fig/avatar-miekg-300x300}
@@ -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{https://github.com/miekg/godns}.
+of the Go DNS library: \url{https://github.com/miekg/godns}.
He maintains a personal blog on \url{http://www.miek.nl} and tweets
under the name \texttt{@miekg}. The postings and tweets may sometimes
View
20 go-communication.tex
@@ -89,10 +89,28 @@ \section{Executing commands}
\func{exit code}, with:
\begin{lstlisting}
w := os.Wait(pid, os.WNOHANG)
-e := w.WaitStatus.ExitStatus() |\coderemark{ExitStatus() return an integer}|
+e := w.WaitStatus.ExitStatus() |\coderemark{ExitStatus() returns an integer}|
\end{lstlisting}
\section{Networking}
+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, 192.0.32.10 and 2620:0:2d0:200::10 are \url{www.example.org}.}
+\begin{lstlisting}
+conn, err := Dial("tcp", "", "192.0.32.10:80")
+conn, err := Dial("udp", "", "192.0.32.10:80")
+conn, err := Dial("tcp", "", "[2620:0:2d0:200::10]:80") |\coderemark{Brackets are mandatory}|
+\end{lstlisting}
+
+And with \var{conn} you can do read/write \todo{dkls}.
+
+\todo{Write echo server}
\section{Netchan: networking and channels}
%%http://blog.golang.org/2010/09/go-concurrency-patterns-timing-out-and.html
View
2  go-interfaces.tex
@@ -323,7 +323,7 @@ \section{A sorting example}
\item Write a \emph{generic} Sort function that works on the \type{Sorter} interface.
\begin{lstlisting}
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)
Please sign in to comment.
Something went wrong with that request. Please try again.