Skip to content

diogok/udp_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UDPServer

Package udp_server created to help build UDP servers faster.

Inspired by firstrow/tcp_server.

Install package

go get -u github.com/diogok/udp_server

Usage:

NOTICE: OnNewMessage callback will receive new message only if it's ending with \n or the setup MessageTerminator

package main

import "github.com/diogok/udp_server"

func main() {
	server := udp_server.New("localhost:9999")
  server.MessageTerminator='\n' // Optional end of message byte, default to newline.

	server.OnNewMessage(func(c *tcp_server.Client, message string) {
		// new message received
	})
	server.Listen()
  server.Close()
}

License

MIT

About

Golang simple UDP Server

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages