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

Package allows you to join two TCP clients or two servers this package includes all the tools you need to connet 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 socketStream = await SocketConnector.serverToServer(
      serverAddressA: InternetAddress.anyIPv4,
      serverAddressB: InternetAddress.anyIPv4,
      serverPortA: 9000,
      serverPortB: 8000,
      verbose: true);
  print(
      'Sender Port: ${socketStream.senderPort().toString()}  Receiver Port: ${socketStream.receiverPort().toString()}');

// 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 socketStream1 = await SocketConnector.socketToServer(
      socketAddress: server!,
      socketPort: 22,
      serverAddress: InternetAddress.anyIPv4,
      receiverPort: 2000,
      verbose: true);
  print(
      'Sender Port: ${socketStream1.senderPort().toString()}  Receiver Port: ${socketStream1.receiverPort().toString()}');
}
3
likes
150
pub points
64%
popularity

Publisher

verified publisheratsign.org

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

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

chalkdart

More

Packages that depend on socket_connector