Question: I'm trying to do a label with size\_hint in a floatlayout but I've realized that doesn't work. I want to make a responsive size of label, because the app wil run in different sizes of screen. I'm doing in kivy language, the code is: 

```
Label:
            text: "I'm trying to make a label with size_hint_y"
            size_hint_y: 0.6 #doesn't work, always the same size of font
            pos_hint: {'center_x':0.5,'center_y':0.36}

```

Answer: 
Try this. It helps you

```cs
delegate void AddTextCallback(string text);

public Form1()
{
    InitializeComponent();
}
private void ButtonConnected_Click(object sender, EventArgs e)
{
    ThreadPool.QueueUserWorkItem(new WaitCallback(ServerHandler));
}

private void ServerHandler(object state)
{
    TcpListener _listner = new TcpListener(IPAddress.Parse("12.2.54.658"), 145);

    _listner.Start();

    AddText("Server started - Listening on port 145");

    Socket _sock = _listner.AcceptSocket();

    //AddText("User from IP " + _sock.RemoteEndPoint);

    while (_sock.Connected)
    {
        byte[] _Buffer = new byte[1024];

        int _DataReceived = _sock.Receive(_Buffer);

        if (_DataReceived == 0)
        {
            break;
        }

        AddText("Message Received...");

        string _Message = Encoding.ASCII.GetString(_Buffer);

        AddText(_Message);
    }

    _sock.Close();
    AddText("Client Disconnected.");

    _listner.Stop();
    AddText("Server Stop.");
}

private void AddText(string text)
{
    if (this.listBox1.InvokeRequired)
    {
        AddTextCallback d = new AddTextCallback(AddText);
        this.Invoke(d, new object[] { text });
    }
    else
    {
        this.listBox1.Items.Add(text);
    }
}

```

I'm also have the same problem like you on last month but i solve that using this [Receive multiple different messages TcpListener C#](http://stackoverflow.com/questions/21072100/receive-multiple-different-messages-tcp-listner-c-sharp) from stackoverflow. This helps me lot hope it helps to solve your problem also.
I'm not 100% sure you understand TCP sockets so here goes.

When you use a TCP listener socket you first bind to a port so that clients have a fixed, known point to connect to. This reserves the port for your socket until you give it up by calling `Close()` on that socket.

Next you Listen in order to begin the process of accepting clients on the port you bound to. You can do both this and the first step in one but as you haven't I haven't here.

Next you call `Accept()`. This blocks (halts execution) until a client connects and then it returns a socket which is dedicated to communication with that client. If you want to allow another client to connect, you have to call `Accept()` again.

You can then communicate with your client using the socket that was returned by `Accept()` until you're done, at which point you call `Close()` on that socket.

When you're done listening for new connections you call `Close()` on your listener socket.

---

However when you press your listen button the following happens:

You bind correctly, you begin listening correctly and then your call to `ReceiveData()` blocks on the Accept call until a client is received. You then receive some data (though this is TCP so that might not be the whole data!) and then you instantly close the connection to your client.

I presume to get the error you're getting you must then press listen again on your server. This therefore restarts the whole listener socket and when you get to bind to the port the second time your previous listener is still bound to it and thus the call fails because something's already allocated on that port.

---

Solution wise you need to keep the socket returned from the `Accept()` call open until you're done with it. Have the client handle the close by calling the `Shutdown()` method on their socket or establish some convention for marking the end of communication.

You're also going to run into trouble when you try and have multiple users connected and so at some point you're either going to require threads or some asynchronous sockets but I feel that's out the scope of this question.