Click here to Skip to main content
15,923,789 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: getting currency format info Pin
nm_11410-Apr-05 10:43
nm_11410-Apr-05 10:43 
GeneralRe: getting currency format info Pin
Ravi Bhavnani10-Apr-05 11:12
professionalRavi Bhavnani10-Apr-05 11:12 
GeneralRe: getting currency format info Pin
nm_11410-Apr-05 14:21
nm_11410-Apr-05 14:21 
Generalim in need of help with mouse Pin
zakaid9-Apr-05 14:04
zakaid9-Apr-05 14:04 
GeneralRe: im in need of help with mouse Pin
Ravi Bhavnani9-Apr-05 16:30
professionalRavi Bhavnani9-Apr-05 16:30 
GeneralRe: im in need of help with mouse Pin
ThatsAlok10-Apr-05 19:02
ThatsAlok10-Apr-05 19:02 
GeneralRe: im in need of help with mouse Pin
ThatsAlok10-Apr-05 19:15
ThatsAlok10-Apr-05 19:15 
GeneralMultiple simultaneous connections Pin
9-Apr-05 13:35
suss9-Apr-05 13:35 
I've recently made a little server based on WinSock. Here is it:
#include <windows.h><br />
<br />
#pragma comment(lib, "wsock32.lib")<br />
<br />
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow)<br />
{<br />
    WSADATA WsaDat;<br />
    if (WSAStartup(MAKEWORD(20), &WsaDat) != 0)<br />
    {<br />
        return 0;<br />
    }<br />
    SOCKET Socket;<br />
    Socket = socket(AF_INET, SOCK_STREAM, 0);<br />
    if (Socket == INVALID_SOCKET)<br />
    {<br />
        return 0;<br />
    }<br />
    SOCKADDR_IN SockAddr;<br />
    SockAddr.sin_port = htons(666);<br />
    SockAddr.sin_family = AF_INET;<br />
    char Name[255];<br />
    gethostname(Name, 255);<br />
    HOSTENT *HostInfo;<br />
    HostInfo = gethostbyname(Name);<br />
    SockAddr.sin_addr.S_un.S_un_b.s_b1 = (unsigned char)HostInfo->h_addr_list[0][0];<br />
    SockAddr.sin_addr.S_un.S_un_b.s_b2 = (unsigned char)HostInfo->h_addr_list[0][1];<br />
    SockAddr.sin_addr.S_un.S_un_b.s_b3 = (unsigned char)HostInfo->h_addr_list[0][2];<br />
    SockAddr.sin_addr.S_un.S_un_b.s_b4 = (unsigned char)HostInfo->h_addr_list[0][3];<br />
    if (bind(Socket, (SOCKADDR *)(&SockAddr), sizeof(SockAddr)) == SOCKET_ERROR) <br />
    { <br />
        return 0;<br />
    }<br />
    listen(Socket, 8);<br />
    SOCKET TempSock = SOCKET_ERROR; <br />
    while (TempSock == SOCKET_ERROR)<br />
    {<br />
        TempSock = accept(Socket, NULL, NULL);<br />
    }<br />
    Socket = TempSock;<br />
    char String[64];<br />
    int ret = 0;<br />
    while (1)<br />
    {<br />
        ret = recv(Socket, String640);<br />
        if (ret > 0)<br />
        {<br />
            // TODO: Add message processing code.<br />
        }<br />
        else<br />
        {<br />
            WSACleanup();<br />
            return 0;<br />
        }<br />
    }<br />
    WSACleanup();<br />
    return 0;<br />
}


I want it to accept multiple simultaneous connections. How do I do it?
GeneralRe: Multiple simultaneous connections Pin
Taka Muraoka9-Apr-05 17:02
Taka Muraoka9-Apr-05 17:02 
GeneralRe: Multiple simultaneous connections Pin
eli150219799-Apr-05 22:04
eli150219799-Apr-05 22:04 
GeneralProblem with VC++ Pin
hithesh9-Apr-05 11:19
hithesh9-Apr-05 11:19 
GeneralRe: Problem with VC++ Pin
Anonymous9-Apr-05 19:17
Anonymous9-Apr-05 19:17 
GeneralRe: Problem with VC++ Pin
Erik Funkenbusch9-Apr-05 19:48
Erik Funkenbusch9-Apr-05 19:48 
GeneralRe: Problem with VC++ Pin
hitcoder9-Apr-05 21:24
hitcoder9-Apr-05 21:24 
GeneralRe: Problem with VC++ Pin
Erik Funkenbusch9-Apr-05 22:04
Erik Funkenbusch9-Apr-05 22:04 
GeneralRe: Problem with VC++ Pin
eli150219799-Apr-05 22:13
eli150219799-Apr-05 22:13 
GeneralRe: Problem with VC++ Pin
hithesh10-Apr-05 5:49
hithesh10-Apr-05 5:49 
GeneralRe: Problem with VC++ Pin
eli1502197910-Apr-05 6:23
eli1502197910-Apr-05 6:23 
GeneralRe: Problem with VC++ Pin
Michael Dunn10-Apr-05 10:33
sitebuilderMichael Dunn10-Apr-05 10:33 
GeneralRe: Problem with VC++ Pin
hithesh10-Apr-05 15:58
hithesh10-Apr-05 15:58 
GeneralRe: Problem with VC++ Pin
hithesh11-Apr-05 20:45
hithesh11-Apr-05 20:45 
Generaldelete files from c++ code Pin
monageasmear9-Apr-05 11:06
monageasmear9-Apr-05 11:06 
GeneralRe: delete files from c++ code Pin
Graham Bradshaw9-Apr-05 11:55
Graham Bradshaw9-Apr-05 11:55 
GeneralRe: delete files from c++ code Pin
Verolix9-Apr-05 13:39
Verolix9-Apr-05 13:39 
GeneralRe: delete files from c++ code Pin
Erik Funkenbusch9-Apr-05 19:50
Erik Funkenbusch9-Apr-05 19:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.