fengzhizi715 / androidserver Goto Github PK
View Code? Open in Web Editor NEW基于 Kotlin + Netty 开发,为 Android App 提供 Server 的功能,包括 Http、TCP、WebSocket 服务
基于 Kotlin + Netty 开发,为 Android App 提供 Server 的功能,包括 Http、TCP、WebSocket 服务
因為kotlin也要跨平台
在網路層部分
推出ktor
所以問問
謝謝
用的文件转base64来传递一些配置文件,最大大概10M出头...默认配置无法接收完全
最后再NettyWebSocketServerInitializer这个类里面找到了
pipeline.addLast("aggregator", HttpObjectAggregator(65536))
这个方法控制长度
但是实测修改成5和2010241024,获取到的数据长度都不会变化,也就是参数根本没生效
netty似乎不支持android平台的https
在上传文件的时候提示这个,请问是需要在哪里设置一下文件大小限制?
使用socket方式通信,连接和断开的回调可以收到,收消息的回调收不到
androidServer
.websocket("ws://${localIPAddress}:${port}/ws", object : SocketListener {
override fun onMessageResponseServer(msg: String, ChannelId: String) {
Log.e("WebSocketService", "msg = $msg")
}
override fun onChannelConnect(channel: Channel) {
val insocket = channel.remoteAddress() as InetSocketAddress
val clientIP = insocket.address.hostAddress
Log.e("WebSocketService", "connect client: $clientIP")
}
override fun onChannelDisConnect(channel: Channel) {
val ip = channel.remoteAddress().toString()
Log.e("WebSocketService", "disconnect client: $ip")
}
})
.start()
我是这样写的,localIPAddress是用的你库里边的工具类,端口写的8080,然后AS查看日志,一直报disconnect client: /127.0.0.1:xxxx,
端口号一直在变化
如题
Getting following exception when have two app server, let me know one things that how i can unbind with close server @fengzhizi715 ?
java.net.BindException: Address already in use
@fengzhizi715 after upgrade 1.3.3 unable to find all packages related library
like :- com.safframework.server.core.AndroidServer
fun startHTTPServer(context:Context, androidServer: AndroidServer) {
androidServer
.get("/ping") {request, response ->
response.setBodyText("pong")
}
.start()
}
curl -v 127.0.0.1:8080/ping?id=1&name=test
response {"nameValuePairs":{"status":404,"reason":"404 Not Found"}}
不好意思不是很明白,请问您的库是指app本身作为服务端的意思吗?还是说提供了一组api去发送网络请求呢
@fengzhizi715 facing one serious issue while change wifi with background restart server
java.net.BindException: Address already in use
When i start server from one device and any operation perform on server device at that time other connected device with server need to wait or you can say take time for get response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.