1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

socket program

Discussion in 'C' started by kush, Oct 6, 2011.

  1. kush

    kush New Member

    Joined:
    Oct 6, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    //#include"stdafx.h"
    #include<windows.h>
    #include<winsock.h>
    #include<stdio.h>
    #include<windows.h>
    int APIENTRY WinMain(HINSTANCE hlnstance,HINSTANCE hprevlnstance,LPSTR lpCmdLine,int nCmdShow)
     {
                 WSADATA ws;
                 char buf[1000],buf1[100],buf2[100],buf3[100],buf4[100],buf5[100],buf6[100];
                 WSAStartup(0x0101,&ws);
                 // buf[0]=" ";
                 sprintf(buf1,"\nWinsock Ver Request: %d.%d",HIBYTE(ws.wVersion),LOBYTE(ws.wVersion));
                 sprintf(buf2,"\nWinsock Ver Avilable: %d.%d",HIBYTE(ws.wHighVersion),LOBYTE(ws.wHighVersion));
                 sprintf(buf3,"\nCurrent Winsock imlementation: %s",&ws.szDescription);
                 sprintf(buf4,"\nSystem status: %s",&ws.szSystemStatus);
                 sprintf(buf5,"\nMaximum Socket: %u",&ws.iMaxSockets);
                 strcat(strcat(strcat(strcat(strcat(strcat(buf,buf1),buf2),buf3),buf4),buf5),buf6);
                 MessageBox(0,buf,"info",0);
                 WSACleanup();
                 return 0;
    }

    i am using windows7 and dev c compiler bt this prog is not compiling please help me this prog is just to make socket
     
    Last edited by a moderator: Oct 7, 2011
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    "not compiling" is no help at all. It gives us no clue what might be wrong. What errors do you get? Copy and paste the top five *exactly* and this might help.
     

Share This Page