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
B

Bob Groves

@Bob Groves
About
Posts
20
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Unix MFC
    B Bob Groves

    Not MFC, but you might want to check out www.borland.com, who have announced plans to support RAD C++ for Linux. Rob.

    The Lounge c++ question learning

  • listen() problem
    B Bob Groves

    Yes, you would have to go through that cycle. Have a look at MFC'c CSocket, or wrap up the code in your own class to make this easier. Regards, Bob.

    C / C++ / MFC help sysadmin question

  • listen() problem
    B Bob Groves

    I've never used the FD_??? macros, but I just tried the following in the 10 minutes before I went home, and it works OK. I tested it by running "telnet 127.0.0.1 1001" from the DOS prompt twice. The 1st connects, the 2nd doesn't. I hope it works for you too. Gotta run now..... Bob. #include void StartupWinSock() { WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD(2, 0); err = ::WSAStartup(wVersionRequested, &wsaData); } void CSimplesockDlg::OnButton1() { StartupWinSock(); SOCKET s1 = socket(PF_INET, SOCK_STREAM, 0); if (s1 == INVALID_SOCKET) { AfxMessageBox("error creating socket"); return; } struct sockaddr_in serv_addr; memset((char *)&serv_addr, 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); serv_addr.sin_port = htons(1001); if (bind(s1, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) { AfxMessageBox("error binding socket"); return; } if (listen(s1, 1) == SOCKET_ERROR) { AfxMessageBox("error listening on socket"); return; } SOCKET s2 = accept(s1, 0, 0); if (s2 == INVALID_SOCKET) { if (WSAGetLastError() != WSAEWOULDBLOCK) { AfxMessageBox("error accepting socket"); return; } } closesocket(s1); // DO stuff with s2 // No new clients should be able to connect // The Sleep is just so that my simple server does not immediately close down, in real life, you would do you code here. Sleep(60000); }

    C / C++ / MFC help sysadmin question

  • listen() problem
    B Bob Groves

    You need to close the accepting socket. eg pseudocode... SOCKET s1 = socket() SOCKET s2 = accept(s1,...) // Now client one is connected to s2 closesocket(s1) // Now no more clients can connect // you need to re-open s1 should the s2 connection fail for any reason. Bob/Rob are both short forms of Robert. At work I am Bob, at Home Rob. I get confused as well sometimes!!

    C / C++ / MFC help sysadmin question

  • Two threads in different processes
    B Bob Groves

    The following possibilities spring to mind... * mutex/event if only signalling is required * Memory mapped files(I seem to recall a rather nice tutorial on this site somewhere) *Sockets *Local RPC (You need to understand IDL) *Named pipes (Similar in concept to sockets) *DCOM I'd probably use sockets myself, because that's what I'm most familiar with. Rob.

    C / C++ / MFC question

  • listen() problem
    B Bob Groves

    I have come across this before. First off, I beleive the parameter to listen() is the queue size, so it is valid to be handling 1 call and having one in the queue. Is there any reason you can only have one client? Typical pattern would be to have a server thread for each client. One way I have seen your problem solved is to close the accepting socket straight after the first call to accept. The 2nd client will the get a connection refused error. When you server has finished with the 1st client, it can then re-open the accepting socket. HTH Rob.

    C / C++ / MFC help sysadmin question

  • Windows Messages
    B Bob Groves

    I am deriving a new control from ListBox in which I wish to intercept certain windows messages. From what I can see, I need to override WndProc(ref m message) and then examine m.Msg. The trouble is, constants for Windows Messages such as WM_VSCROLL, do not seem to be defined anywhere. Am I working along the right lines? Rob.

    C# question

  • Depressed today... any good jokes??
    B Bob Groves

    Ever read "Time's Arrow" by Martin Amis? It follows the theme of your email, but for a Nazi.

    The Lounge question

  • ASP.NET Server Side Controls
    B Bob Groves

    I have been thinking about the server side controls in ASP.NET and was wondering of anybody is planning to use them as they seem to offer some benefits. They are also in ASP, yet as far as I know, they are not widely used, certainly I have never come across it. Should I just carry on writing ASP scripts but take advantage of the compiled code in ASP.NET, or should I be looking to change the way I develop web apps? What are other people planning to do? Bob.

    Web Development csharp asp-net sysadmin question

  • A serious Linux Question
    B Bob Groves

    Not sure if you are aware of this but Borland have released Kylix, which is Delphi for Linux. Admittedly this is Pascal based, but on the windows platform, where Delphi leads, C++ Builder usually follows, so I would expect the same to happen on Linux. Dr Dobb's journal has the Al Stevens programming column, and he is currently coming to grips with Linux programming, having been a Windows adherent in the past. Can't say it sounds all that simple though!! No I do not work for Dr Dobbs if you have seen my other email.

    The Lounge c++ com question csharp visual-studio

  • Why I hate Microsoft and .Net....
    B Bob Groves

    I got a free copy of .NET Beta 2 and VStudio Beta 2 with this month's Dr Dobb's Journal. Haven't had time to load it yet so I can't say if it is corrupt or not.

    The Lounge csharp beta-testing question learning

  • Pass NULL to stored procedure with ADO
    B Bob Groves

    Hi all, I have a situation where I wish to pass a NULL to a varchar(200) parameter of an SQL Server stored procedure using ADO and Visual C++. I have tried various things, but with no success. Anybody done this before? Thanks, Bob.

    C / C++ / MFC c++ database sql-server sysadmin question

  • MSDE ???
    B Bob Groves

    I think that is exactly what you want. The CD comes with VStudio 6 or you can download at http://msdn.microsoft.com/vstudio/msde/default.asp. You will not get any of the tools, i.e. Query Analyser or Emterprise manager, just the DB engine. Cheers, Bob.

    C / C++ / MFC database csharp c++ sql-server visual-studio

  • CStatic Control
    B Bob Groves

    You can use CWnd::SetFont(), and I always use CFont::CreatePointFont() for convenience. Cheers, Bob.

    C / C++ / MFC question com

  • Which method of CFile write a new line in text file ?
    B Bob Groves

    Could you use CStdioFile instead, that has a WriteString method.

    C / C++ / MFC question

  • Thread
    B Bob Groves

    Yes. You will get two threads running, each with "Function" as its main.

    C / C++ / MFC question

  • Problem with Threads
    B Bob Groves

    Need to know a bit more. Is the component shared among threads? What threading model is being used? Is a shared DB connection being used? One thing that springs to mind about debug ~vs~ release is the speed. As release is faster, it may be causing a problem. How does Access do its locking, is it per row, table or block? if per table or block you may need to synchronise access to the DB to prevent collisions. HTH.

    C / C++ / MFC help database debugging question

  • Hw to use CArray template
    B Bob Groves

    darn this thing, it's... afxtempl.h

    C / C++ / MFC c++ help question java delphi

  • Hw to use CArray template
    B Bob Groves

    oops, the name of the header you need is

    C / C++ / MFC c++ help question java delphi

  • Hw to use CArray template
    B Bob Groves

    Hi, You need to #include probably in stdafx.h for ease. Also you will need a copy constructor and operator= for your class yourclass(const yourclass& c) yourclasss& operator=(const yourclass& rhs) HTH Bob.

    C / C++ / MFC c++ help question java delphi
  • Login

  • Don't have an account? Register

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