saio


License

License

Categories

Categories

Data
GroupId

GroupId

io.github.idata-shopee
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/idata-shopee/saio
Project Organization

Project Organization

io.github.idata-shopee
Source Code Management

Source Code Management

https://github.com/idata-shopee/saio

Download saio_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.idata-shopee/saio_2.12/ -->
<dependency>
    <groupId>io.github.idata-shopee</groupId>
    <artifactId>saio_2.12</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.idata-shopee/saio_2.12/
implementation 'io.github.idata-shopee:saio_2.12:0.0.2'
// https://jarcasting.com/artifacts/io.github.idata-shopee/saio_2.12/
implementation ("io.github.idata-shopee:saio_2.12:0.0.2")
'io.github.idata-shopee:saio_2.12:jar:0.0.2'
<dependency org="io.github.idata-shopee" name="saio_2.12" rev="0.0.2">
  <artifact name="saio_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.idata-shopee', module='saio_2.12', version='0.0.2')
)
libraryDependencies += "io.github.idata-shopee" % "saio_2.12" % "0.0.2"
[io.github.idata-shopee/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!")
}

Versions

Version
0.0.2
0.0.1