saio


License

License

GroupId

GroupId

io.github.lock-free
ArtifactId

ArtifactId

saio_2.12
Last Version

Last Version

0.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

saio
saio
Project URL

Project URL

https://github.com/lock-free/saio
Project Organization

Project Organization

io.github.lock-free
Source Code Management

Source Code Management

https://github.com/lock-free/saio

Download saio_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.lock-free/saio_2.12/ -->
<dependency>
    <groupId>io.github.lock-free</groupId>
    <artifactId>saio_2.12</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.lock-free/saio_2.12/
implementation 'io.github.lock-free:saio_2.12:0.0.2'
// https://jarcasting.com/artifacts/io.github.lock-free/saio_2.12/
implementation ("io.github.lock-free:saio_2.12:0.0.2")
'io.github.lock-free:saio_2.12:jar:0.0.2'
<dependency org="io.github.lock-free" name="saio_2.12" rev="0.0.2">
  <artifact name="saio_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.lock-free', module='saio_2.12', version='0.0.2')
)
libraryDependencies += "io.github.lock-free" % "saio_2.12" % "0.0.2"
[io.github.lock-free/saio_2.12 "0.0.2"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.4

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.0.1

Project Modules

There are no modules declared in this project.

saio

AIO library for scala

Quick example

import io.github.free.lock.saio.{ AIO, ConnectionHandler, AIOConnection }
import java.net.InetSocketAddress
import scala.concurrent.ExecutionContext.Implicits.global

val server = AIO.getTcpServer(
  onConnection = (connection: AIOConnection.Connection) => {
    ConnectionHandler(
      connection,
      onData = (data: Array[Byte]) => {
        val text = new String(data, "UTF-8")
        println(s"recieved data: ${text}") 
      }
    )
  }
)

val port = server.getLocalAddress().asInstanceOf[InetSocketAddress].getPort()

AIO.getTcpClient(port = port) map {
  conn =>
    val connHandler = ConnectionHandler(conn)
    connHandler.sendMessage("hello world!")
}
io.github.lock-free

LockFree

Versions

Version
0.0.2