socket_connector 2.0.1 copy "socket_connector: ^2.0.1" to clipboard
socket_connector: ^2.0.1 copied to clipboard

Package allows you to join two TCP clients or two servers this package includes all the tools you need to connect and optionally print the traffic.

example/socket_connector_example.dart

import 'dart:io';

import 'package:socket_connector/socket_connector.dart';

void main() async {
  // Once running use ncat to check the sockets
  SocketConnector socketConnector = await SocketConnector.serverToServer(
    addressA: InternetAddress.anyIPv4,
    addressB: InternetAddress.anyIPv4,
    portA: 9000,
    portB: 8000,
    verbose: true,
    logTraffic: true,
  );
  print('Sender Port: ${socketConnector.sideAPort}'
      ' Receiver Port: ${socketConnector.sideBPort}');

// Connects to ssh on port 22 on 192.168.1.149 to port 2000 on localhost
// 'ssh -p localhost' will transport you to 192.168.1.149's sshd server
  InternetAddress? server = InternetAddress.tryParse('192.168.1.149');
  SocketConnector connector1 = await SocketConnector.socketToServer(
      addressA: server!,
      portA: 22,
      addressB: InternetAddress.anyIPv4,
      portB: 2000,
      verbose: true);
  print('Sender Port: ${connector1.sideAPort}'
      ' Receiver Port: ${connector1.sideBPort}');
}
4
likes
0
points
774
downloads

Publisher

verified publisheratsign.org

Weekly Downloads

Package allows you to join two TCP clients or two servers this package includes all the tools you need to connect and optionally print the traffic.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

chalkdart

More

Packages that depend on socket_connector