Pascal's Blog

Golang

From TCP to TLS in Go

  • Dec 17, 2015
  • POST
Start plain In this post we will have a look at a simple TCP example in Go and how it can be changed to use secure TLS instead. Plain TCP server First let’s have a look at a simple TCP server. It listens on port 8088 and prints everything it receives to stdout. package main import ( "fmt" "io" "log" "net" "os" ) func main() { l, err := net.Listen("tcp", ":8088") if err != nil { log.Fatal(err) } defer l.Close() for { conn, err := l.Accept() if err != nil { log.Fatal(err) } go func(c net.Conn) { io.Copy(os.Stdout, c) fmt.Println() c.Close() }(conn) } } Plain TCP client Next we have a client that will send a message to the above server.
LATESTS
Files Is All You Need: The Simple Agent Pattern
  • Mar 25, 2026
  • POST
NixOS on a MinnowBoard MAX and Turbot (serial console)
  • Nov 10, 2016
  • POST
Keep your docker clean
  • Nov 7, 2016
  • POST
From TCP to TLS in Go
  • Dec 17, 2015
  • POST
Configurable Yocto/OpenEmbedded recipes
  • Feb 14, 2015
  • POST
New Unison (2.40.102) builds available
  • Jun 5, 2013
  • POST
Using Cygwin SSH with Putty Pageant
  • Mar 11, 2011
  • POST
Use Zentyal Zarafa z-push with an N900
  • Oct 19, 2010
  • POST
Build Ubuntu/Debian packages from source (and apply a patch)
  • May 6, 2010
  • POST
Automatically start SCREEN on SSH login
  • Apr 30, 2010
  • POST
CATEGORIES
  • development (15)
  • howto's (14)
  • experience (6)
  • projects (2)
  • best practice (1)
  • yocto (1)
TAGS
  • python (9)
  • ucplib (5)
  • openmoko (4)
  • sms (4)
  • bzr (3)
  • proe (3)
  • ssh (3)
  • ubuntu (3)
  • vlc (3)
  • vmware (3)

© Pascal's Blog

Powered by Hugo.

Robust designed by Daisuke Tsuji.