Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. any lib to be added to make it work or any changes to be done?

any lib to be added to make it work or any changes to be done?

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    ShaluMalu
    wrote on last edited by
    #1

    hi! i compiled the following code... some error is being shown in _endthreadex and _beginthread mpr.lib and wsock32.lib is included but still not working... pls tell me if any other changes has to be made... // HEADER FILE #include #include #include #include #include #include char buffer[]="ANY DATA"; // Static Global Data /*-------------------------------------------------------------------*/ void MyFunction( void* Arg ) { SOCKET Client=(*(int *)Arg); while(1) { send(Client,buffer,100,0); } _endthreadex(0); } /*--------------------------------------------------------------------*/ void main(void) { int a,b,c,d; // For Server Address or Address of P1. int port; // For Port No of Server or Port of P1. struct sockaddr_in serv_addr,cli_addr; SOCKET Server; SOCKET Client; int clilen=sizeof(cli_addr); /***************************************************/ /* SOCKET INITIALISATION */ /***************************************************/ WSADATA WsaDat; if (WSAStartup(MAKEWORD(1,1),&WsaDat) != 0) { printf("\n\n WSA Initialization failed! STOP!!!"); exit(1); } /***************************************************/ /* SOCKET CREATION */ /***************************************************/ Server = socket(AF_INET, SOCK_STREAM, 0); if (Server == INVALID_SOCKET) { printf("\n\n Socket creation failed!STOP!!!"); exit(1); } else printf("\n\n SOCKET IS CREATED SUCCESSFULLY..."); /***************************************************/ /* SERVER ADDRESS */ /***************************************************/ serv_addr.sin_family=AF_INET; printf("\n\n ENTER THE SERVER IP "); scanf("%d%d%d%d",&a,&b,&c,&d); serv_addr.sin_addr.S_un.S_un_b.s_b1 =a ; serv_addr.sin_addr.S_un.S_un_b.s_b2 =b ; serv_addr.sin_addr.S_un.S_un_b.s_b3 =c ; serv_addr.sin_addr.S_un.S_un_b.s_b4 =d ; printf("\n\n ENTER THE PORT NO "); scanf("%d",&port); serv_addr.sin_port = htons(port); /***************************************************/ /* BIND THE SOCKET*/ /***************************************************/ if (bind(Server,(struct sockaddr *)(&serv_addr),sizeof(ser

    P 1 Reply Last reply
    0
    • S ShaluMalu

      hi! i compiled the following code... some error is being shown in _endthreadex and _beginthread mpr.lib and wsock32.lib is included but still not working... pls tell me if any other changes has to be made... // HEADER FILE #include #include #include #include #include #include char buffer[]="ANY DATA"; // Static Global Data /*-------------------------------------------------------------------*/ void MyFunction( void* Arg ) { SOCKET Client=(*(int *)Arg); while(1) { send(Client,buffer,100,0); } _endthreadex(0); } /*--------------------------------------------------------------------*/ void main(void) { int a,b,c,d; // For Server Address or Address of P1. int port; // For Port No of Server or Port of P1. struct sockaddr_in serv_addr,cli_addr; SOCKET Server; SOCKET Client; int clilen=sizeof(cli_addr); /***************************************************/ /* SOCKET INITIALISATION */ /***************************************************/ WSADATA WsaDat; if (WSAStartup(MAKEWORD(1,1),&WsaDat) != 0) { printf("\n\n WSA Initialization failed! STOP!!!"); exit(1); } /***************************************************/ /* SOCKET CREATION */ /***************************************************/ Server = socket(AF_INET, SOCK_STREAM, 0); if (Server == INVALID_SOCKET) { printf("\n\n Socket creation failed!STOP!!!"); exit(1); } else printf("\n\n SOCKET IS CREATED SUCCESSFULLY..."); /***************************************************/ /* SERVER ADDRESS */ /***************************************************/ serv_addr.sin_family=AF_INET; printf("\n\n ENTER THE SERVER IP "); scanf("%d%d%d%d",&a,&b,&c,&d); serv_addr.sin_addr.S_un.S_un_b.s_b1 =a ; serv_addr.sin_addr.S_un.S_un_b.s_b2 =b ; serv_addr.sin_addr.S_un.S_un_b.s_b3 =c ; serv_addr.sin_addr.S_un.S_un_b.s_b4 =d ; printf("\n\n ENTER THE PORT NO "); scanf("%d",&port); serv_addr.sin_port = htons(port); /***************************************************/ /* BIND THE SOCKET*/ /***************************************************/ if (bind(Server,(struct sockaddr *)(&serv_addr),sizeof(ser

      P Offline
      P Offline
      Programm3r
      wrote on last edited by
      #2

      Hi, WSAStartup Have you linked the following lib file to your project: Library Use -> Ws2_32.lib : Link WSAStartup[^] _beginthread Have you included the following header file to your project: #include <process.h> /* _beginthread, _endthread */ Link _beginthread[^] Regards,


      The only programmers that are better than C programmers are those who code in 1's and 0's..... :) :)Programm3r My Blog: ^_^

      S 1 Reply Last reply
      0
      • P Programm3r

        Hi, WSAStartup Have you linked the following lib file to your project: Library Use -> Ws2_32.lib : Link WSAStartup[^] _beginthread Have you included the following header file to your project: #include <process.h> /* _beginthread, _endthread */ Link _beginthread[^] Regards,


        The only programmers that are better than C programmers are those who code in 1's and 0's..... :) :)Programm3r My Blog: ^_^

        S Offline
        S Offline
        ShaluMalu
        wrote on last edited by
        #3

        thanks a lot for ur earliest reply.. i will try out with ur information sir.... thanks again...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups