[HELP]Winsock Error "syntax error before ';' token"

This is a discussion on [HELP]Winsock Error "syntax error before ';' token" within the C Programming forums, part of the General Programming Boards category; hey guys, i'm just wondering why i'm getting this error, i've got plenty of these compiler errors before, but i've ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    4

    [HELP]Winsock Error "syntax error before ';' token"

    hey guys, i'm just wondering why i'm getting this error, i've got plenty of these compiler errors before, but i've been able to spot the error and fix it easily, but i've been looking at the same line of code for around 30 minutes now and i can't seem to figure it out. here is the part of code where it is happening.

    Code:
    case Button_1:            
    GetWindowText(GetDlgItem(hwnd,IDB_TEXT1),ipaddr,sizeof(ipaddr));
    WSAStartup(MAKEWORD(1,1),&WsaData);
    SOCKADDR_IN SockAddr;
    Socket = socket(2,1,0);
    SockAddr.sin_port = htons(1234);
    SockAddr.sin_family = 2;
    SockAddr.sin_addr.s_addr = inet_addr(ipaddr);
    connect(Socket, (struct SOCKADDR *) &SockAddr, sizeof(SockAddr);
    the red highlighted line is where i'm getting the error.

    thanks in advance.

  2. #2
    Registered User
    Join Date
    Apr 2006
    Posts
    2,053
    You're missing a ')' for connect.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    4
    Quote Originally Posted by King Mir View Post
    You're missing a ')' for connect.
    ahh, stupid mistake :/ , well i've been up for a while, guess i must be getting tired hehe. thanks very much for your quick response.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21