# Getting Started

## Client Side

{% code title="" %}

```csharp
using CodeReaper;

// define exSocket object
exSocket sckClient = new exSocket();

public Form1()
{
    InitializeComponent();

    // Set default IP and Port
    sckClient.remoteIP = "127.0.0.1";
    sckClient.remotePort = 9001;

    // Link object with event handler
    sckClient.onConnect += SckClient_onConnect;
    sckClient.onDisconnect += SckClient_onDisconnect;
    sckClient.onDataArrival += SckClient_onDataArrival;

    // Set ConnectInterval (ms)
    sckClient.ConnectInterval = 1000;
    // Set AutoConnectEnable flag to true
    sckClient.AutoConnectEnable = true;
}

private void SckClient_onConnect(object sender)
{
    // Connected!
}

private void SckClient_onDisconnect(object sender)
{
    // Disconnected!
}

private void SckClient_onDataArrival(object sender, byte[] Data, int bytesRead)
{
    MessageBox.Show(Encoding.UTF8.GetString(Data));
}

```

{% endcode %}

## Server Side

```csharp
using CodeReaper;

// define exSocket object
exSocket sckServer = new exSocket();

public Form1()
{
    InitializeComponent();

    // Set Local Port to listen.
    sckServer.LocalPort = 9001;

    sckServer.onConnect += SckServer_onConnect;
    sckServer.onDisconnect += SckServer_onDisconnect;
    sckServer.onDataArrival += SckServer_onDataArrival;

    // call Listen()
    sckServer.Listen();
}

private void SckServer_onConnect(object sender)
{
    // Connected!
}

private void SckServer_onDisconnect(object sender)
{
    // Disconnected!
}

private void SckServer_onDataArrival(object sender, byte[] Data, int bytesRead)
{
    MessageBox.Show(Encoding.UTF8.GetString(Data));
}

```

## How to send data

```
now working....
```
