Skip to content

WesleiRamos/tcp_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tcp_client

Lib to create tcp clients faster

Usage:

package main

import client "github.com/WesleiRamos/tcp_client"

func main() {
	conexao := client.New("127.0.0.1:1232")

	conexao.OnOpen(func() {
		conexao.WriteString("EAE MAN")
		println("Conectou-se")
	})

	conexao.OnMessage(func(message []byte) {
		println("Menssagem: " + string(message))
	})

	conexao.OnError(func(err error) {
		if !conexao.Connected {
			panic(err)
		} else {
			println(err.Error())
		}
	})

	conexao.Listen()
}

Releases

No releases published

Packages

No packages published

Languages