I'm trying to connect my c# client to my c server.
The client is on Windows and the server on Linux.

The server runs without errors but the client can't connect, the connection times out.

c server:

```
int main()
{
int socketid;
int clientid = 0;
char bufer[1024];
struct sockaddr_in serv_addr, client_addr;
memset(&serv_addr, 0, sizeof(serv_addr));
int addrlen = sizeof(client_addr);

printf("Start\n");

if((socketid = socket(AF_INET, SOCK_STREAM, 0)) < 0){
    printf("Error ceating socket!\n%s", strerror(errno));
    getchar();
    return 0;
}
printf("S0cket created\n");
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = 802;

if(bind(socketid, (struct sockaddr*) &serv_addr, sizeof(serv_addr)) < 0){
    printf("%s\n", strerror(errno));
    getchar();
    return 0;
}
printf("Bindend\n");
listen(socketid, 0);
printf("Listening\n");

printf("Entering loop\n");
while(1)
{
    sleep((50)*1000);
    clientid = accept(socketid, (struct sockaddr*) &client_addr, &addrlen);
    if(clientid > 0){printf("accepted");}else{printf("error");}
}
}

```

C# client:

```
void btnClick(object Sender, EventArgs e)
{
    TcpClient client = new TcpClient();
    client.Connect("192.168.1.102", 802);
}

```

What's wrong?

Thanks in advance
['https://Stackoverflow.com/questions/29035230', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3870191/']
This has been standardized, [proposal 2764: Forward declaration of enumerations (rev. 3)](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf) allowed the forward declaration of enums if you specify the underlying type, whereas before this was not possible.

The main reason is that when the underlying type is not specified the size is implementation defined and can depend on the enumerator values. From the draft C++11 standard section `7.2` *[dcl.enum]*:

> 
> For an enumeration whose underlying type is not fixed, the underlying
>  type is an integral type that can represent all the enumerator values
>  defined in the enumeration. If no integral type can represent all the
>  enumerator values, the enumeration is ill-formed. It is
>  implementation-defined which integral type is used as the underlying
>  type except that the underlying type shall not be larger than int
>  unless the value of an enumerator cannot fit in an int or unsigned
>  int. If the enumerator-list is empty, the underlying type is as if the
>  enumeration had a single enumerator with value 0.
> 
> 
> 

When passing by value it makes sense that not knowing the underlying type is an issue, but why is it an issue when it is a pointer or reference? This matters since apparently on some architectures, *char\** and *int\** can have different sizes as mentioned in this [comp.lang.c++ discussion: GCC and forward declaration of enum](http://compgroups.net/comp.lang.c++/gcc-and-forward-declaration-of-enum/1005825):

> 
> [...] While on most architectures it may not be an issue, on some
>  architectures the pointer will have a different size, in case it is a
>  char pointer. So finally our imaginary compiler would have no idea
>  what to put there to get a ColorsEnum\*[...]
> 
> 
> 

We have the following stackoverflow answer for reference which describes the case where [char\* can be larger than int\*](https://stackoverflow.com/a/15832757/1708801), which backs up the assertion in the discussion above.

Some [more details on the possible sizes of pointers](http://c-faq.com/null/machexamp.html) it looks like `char *` and `void *` are the two main exceptions here and so other object pointers should not have the same issues. So it seems like this case ends up being unique to enums.
It's a difference in design goals.

Forward declaring a class creates an incomplete type that can be used opaquely in pointers/references. This is a very useful property.

An incomplete enum type is not that useful. However being able to declare an enum without declaring what constants are inside that enum **is** useful. The complexity that comes from an incomplete enum type can be avoided by requiring that the size must be specified.

So my best guess is that compiler implementers were kept in mind when this feature was designed, and the committee found that the increased complexity of incomplete enums was not worth the benefits.