```
#include <iostream>
#include <WinSock2.h>
#include <Windows.h>

using namespace std;

SOCKET listener,connector;
SOCKADDR_IN myAddress,remoteAddress;

int main()
{

```

initialize windows for networking

```
WSAData wdata;
WSAStartup(MAKEWORD(2,2),&wdata);

```

initialize listener

```
ZeroMemory(&listener,sizeof(listener));
ZeroMemory(&connector,sizeof(connector));
listener = socket(AF_INET,SOCK_STREAM,0);

```

assign values to struct SOCKADDR\_IN myAddress

```
myAddress.sin_addr.s_addr = INADDR_ANY; //accept any ip
myAddress.sin_family = AF_INET;//tcp
myAddress.sin_port = htons(7000);//changing 7000 port to string with htons method

```

bind listener socket and address to instruct the listener where to look

```
if(bind(listener,(LPSOCKADDR)&myAddress,sizeof(listener)))
{
    cout<< "bound";
}
//listen method
if(listen(listener,1));
{
cout<<"Waiting";
}
int Size = sizeof(remoteAddress);

```

initialize infinite loop to keep listening

```
while(true)
{
    connector = accept(listener,(LPSOCKADDR)&remoteAddress,&Size);
    //read connection request
    if(sizeof(connector)< 0)
    {
        cout <<"noinfo\n";
    }
}
}

```

the code doesnt show "no info" even though there are no clients connected :O i duno wat i did wrong :( pls help me