Niyazi Toros
2018-09-20 13:42:09 UTC
Hi,
With Dart socket client cannot connect to unix server which written with
java.
In java client I also set socket.setSoLinger(true,0); I am guessing this
not available in Dart
and I am thinking that I get error because of this.
Anyone can help me to find why keep I get these errors.
import 'dart:io';
import 'dart:async';
Socket socket;
String _dataToBeSent = â00802020N0307809491508590203000000000000490012001629
01700CD0";
var reply;
// TODO: MAIN
main(List<String> arguments) {
_remoteServerConnect();
}
// TODO: REMOTE SERVER CONNECT
void _remoteServerConnect() async {
Future<Socket> future = Socket.connect(âremote_ip_addressâ,
remote_port);
future.then((client) {
print("connected to server!");
client.handleError((data) {
print(data);
});
client.listen(
(data){
reply = new String.fromCharCodes(data);
print(reply);
},
onDone:(){
print("Done");
},
onError:(error){
print(error);
});
client.writeln(_dataToBeSent + "\n");
}).catchError((){
print('Error connecting');
});
}
ERROR:
connected to server!
Done
Unhandled exception:
SocketException: OS Error: Broken pipe, errno = 32, address = 10.2.170.10,
port = 39240
#0 _rootHandleUncaughtError.<anonymous closure>
(dart:async/zone.dart:1112:29)
#1 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#2 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#3 _runPendingImmediateCallback
(dart:isolate/runtime/libisolate_patch.dart:115:13)
#4 _RawReceivePortImpl._handleMessage
(dart:isolate/runtime/libisolate_patch.dart:172:5)
Process finished with exit code 255
With Dart socket client cannot connect to unix server which written with
java.
In java client I also set socket.setSoLinger(true,0); I am guessing this
not available in Dart
and I am thinking that I get error because of this.
Anyone can help me to find why keep I get these errors.
import 'dart:io';
import 'dart:async';
Socket socket;
String _dataToBeSent = â00802020N0307809491508590203000000000000490012001629
01700CD0";
var reply;
// TODO: MAIN
main(List<String> arguments) {
_remoteServerConnect();
}
// TODO: REMOTE SERVER CONNECT
void _remoteServerConnect() async {
Future<Socket> future = Socket.connect(âremote_ip_addressâ,
remote_port);
future.then((client) {
print("connected to server!");
client.handleError((data) {
print(data);
});
client.listen(
(data){
reply = new String.fromCharCodes(data);
print(reply);
},
onDone:(){
print("Done");
},
onError:(error){
print(error);
});
client.writeln(_dataToBeSent + "\n");
}).catchError((){
print('Error connecting');
});
}
ERROR:
connected to server!
Done
Unhandled exception:
SocketException: OS Error: Broken pipe, errno = 32, address = 10.2.170.10,
port = 39240
#0 _rootHandleUncaughtError.<anonymous closure>
(dart:async/zone.dart:1112:29)
#1 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#2 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#3 _runPendingImmediateCallback
(dart:isolate/runtime/libisolate_patch.dart:115:13)
#4 _RawReceivePortImpl._handleMessage
(dart:isolate/runtime/libisolate_patch.dart:172:5)
Process finished with exit code 255
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/9a1beb21-453a-4616-b526-09b907e743b1%40dartlang.org.
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/9a1beb21-453a-4616-b526-09b907e743b1%40dartlang.org.