Skip navigation.
 
mlRe: Problem with bsd sockets
FROM : Robert Tillyard
DATE : Fri Jan 03 20:44:27 2003

Not sure if it's the cause of your problem but I think you need an
extra set of brackets around the first line, i.e.

    if ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) < 0) {

Regards, Rob.


On Friday, January 3, 2003, at 07:22  pm, Quentin Mathi wrote:

> When I run the code below in Cocoa application with Project Builder, I
> get an error : socket already connected everytime, even when my
> internet connection is turned off. I have found no explanation about
> this problem in the book Unix network programming I hope someone can
> help me
>
>    int sockfd; // socket file descriptor
>    struct sockaddr_in serverAddress;
>    char buffer[201];
>    int n;
>
>    if (sockfd = socket(AF_INET, SOCK_STREAM, 0) < 0) {
>        perror("socket");
>        exit(1);
>    }
>
> ...
> --
> Quentin Mathi
> <email_removed>

_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlProblem with bsd sockets Quentin Mathé Jan 3, 20:22
mlRe: Problem with bsd sockets Robert Tillyard Jan 3, 20:44