Guest User

Untitled

a guest
Mar 30th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.32 KB | None | 0 0
  1. package main
  2. import (n"net"
  3. t"strings"
  4. r"strconv"
  5. x"regexp"
  6. "os")
  7. func main(){l,_:=n.Listen("tcp",":"+os.Args[1])
  8. for{c,_:=l.Accept()
  9. var s int=0
  10. for _,i:=range t.Split(x.MustCompile(":[0-9]+$").ReplaceAllLiteralString(c.RemoteAddr().String(),""),"."){
  11. n,_:=r.Atoi(i)
  12. s=s+n}
  13. c.Write([]byte(r.Itoa(s)))
  14. c.Close()}}
Advertisement
Add Comment
Please, Sign In to add comment