Goxoy Socket Client

Soket İstemcisi için RUST tabanlı kütüphane.

Kullanım / Örnekler

```rust // önce nesneyi oluşturup, sonrasında ayarları tanımlayabilirsiniz. let mut client_obj = SocketClient::new());

// bağlantı esnasında ayarları tanımlayabilirsiniz. clientobj.connectwithconfig(AddressParser { ipaddress: "127.0.0.1".tostring(), portno: 1234, protocoltype: ProtocolType::TCP, ipversion: IPAddressVersion::IpV4, });

// ayarlar ile nesneyi oluşturmak için let mut clientobj = SocketClient::newwithconfig(AddressParser { ipaddress: "127.0.0.1".tostring(), portno: 1234, protocoltype: ProtocolType::TCP, ipversion: IPAddressVersion::IpV4, });

//mesaj gelince devreye girecek fonksiyon clientobj.onreceived( |data| { println!("Data Received : {}", String::from_utf8(data.clone()).unwrap()); });

// sunucu bağlantı durumları tetiklendiğinde clientobj.onconnectionstatus( |connectionstatus| { match connection_status { SocketConnectionStatus::Connected => { println!("Socket Connected"); }, SocketConnectionStatus::Disconnected => { println!("Socket Disconnected"); }, } });

// hata oluştuğunda devreye girecek fonksiyon clientobj.onerror(|errortype| { match errortype { SocketClientErrorType::Connection => { println!("Connection Error"); }, SocketClientErrorType::Communication => { println!("Communication Error"); }, } });

// ayarları nesneyi oluştururken belirttiyseniz, doğrudan bağlantı kurabilirsiniz. client_obj.connect();

// mesaj göndermek için let resultobj = clientobj.send("testmsg".asbytes().tovec()); if resultobj==true { println!("Message Sended"); }else{ println!("Message Sending Error"); }

```

Lisans

MIT