Skip to content

Latest commit

 

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blue

Build Status

An asynchronous networking library that just works

How to Use

You can check out the test directory for full use cases

Create a server

Setup event handlers for the server then start it providing the IP and Port

val server = BlueServer()
server.onConnected += { ch -> 
    System.err.println("Client connected")
    ch.channel.write(ByteBuffer.wrap("Hello!")).get() 
    }


server.onReceived += { receivedEventArgs ->
    serverRead += receivedEventArgs.bytes.size
    received = String(receivedEventArgs.bytes)
    println("Server received:$received")
    }

server.start("localhost", 60001)

Connect a client

Connect to a server using IP and Port then send messages

val client = BlueClient()

// Register for events
client.onConnected += { /* Your code here */ }
client.onReceived += { b:ByteArray -> /*your code here*/ }

// Simple usage
client.connect("localhost", 6001)
client.send("Hello World!".toByteArray())

About

An asynchronous networking library that just works

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages