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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Winsock and MFC

Winsock and MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpsysadminquestion
5 Posts 3 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
    sweep123
    wrote on last edited by
    #1

    I have downloaded and used:-

    simples.c - Simple TCP/UDP server using Winsock 1.1

    Now I have built and run a Client and Server Win32 Console application using this sample using my data structure. But problem with using the same code in a worker thread of a MFC application. The following line causes problems:- char *interface= NULL; It generates the following errors:- c:\ExampleDlg.cpp(214): error C2332: 'struct' : missing tag name c:\ExampleDlg.cpp(214): error C2011: '__unnamed' : 'enum' type redefinition c:\ExampleDlg.cpp(214): warning C4518: '__unnamed ' : storage-class or type specifier(s) unexpected here; ignored c:\ExampleDlg.cpp(214): error C2059: syntax error : '=' Whats the solution to this problem please anyone?

    M 1 Reply Last reply
    0
    • S sweep123

      I have downloaded and used:-

      simples.c - Simple TCP/UDP server using Winsock 1.1

      Now I have built and run a Client and Server Win32 Console application using this sample using my data structure. But problem with using the same code in a worker thread of a MFC application. The following line causes problems:- char *interface= NULL; It generates the following errors:- c:\ExampleDlg.cpp(214): error C2332: 'struct' : missing tag name c:\ExampleDlg.cpp(214): error C2011: '__unnamed' : 'enum' type redefinition c:\ExampleDlg.cpp(214): warning C4518: '__unnamed ' : storage-class or type specifier(s) unexpected here; ignored c:\ExampleDlg.cpp(214): error C2059: syntax error : '=' Whats the solution to this problem please anyone?

      M Offline
      M Offline
      Manikandan
      wrote on last edited by
      #2

      May be the download stuff itself got some bugs in !!! May I know what you trying to do?

      S 1 Reply Last reply
      0
      • M Manikandan

        May be the download stuff itself got some bugs in !!! May I know what you trying to do?

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

        Just want to receive a packet of data from another application on another PC. So I will be the Server. The Microsoft sample works fine (as a console application), but its when you try and use the code in an MFC application get these errors.

        M T 2 Replies Last reply
        0
        • S sweep123

          Just want to receive a packet of data from another application on another PC. So I will be the Server. The Microsoft sample works fine (as a console application), but its when you try and use the code in an MFC application get these errors.

          M Offline
          M Offline
          Manikandan
          wrote on last edited by
          #4

          I use NDK from the link below, http://www.codeproject.com/internet/ndk.asp?df=100&forumid=1156&exp=0&select=756975 it's just nice;P

          1 Reply Last reply
          0
          • S sweep123

            Just want to receive a packet of data from another application on another PC. So I will be the Server. The Microsoft sample works fine (as a console application), but its when you try and use the code in an MFC application get these errors.

            T Offline
            T Offline
            Tom Wright
            wrote on last edited by
            #5

            Try looking at CAsyncSocket or CSocket. Also it would be better to make your thread a UI thread so that it can receive events on the socket. Also if you do it that way it is better to create the socket in each thread. Take a look at Joseph Newcomer's website about threads and sockets. [^] Tom Wright tawright915@yahoo.com

            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