MFC based client server application query?

Hi experts

I have developed an client server application using MFC sockets support.

The server is a dialog based application & the client is an SDI application.

I am having problem with sending data from client to server.

After starting the server application, i start the client and try to connect
& send data to server using the following code.

void CMainFrame::OnConnect()
CSimpleSDIsockclientApp  *pApp     =

   int res = pApp->ClientSocket.Create(40000);

      MessageBox("Client Socket at port no. 40000 Successfully created!");

      res = pApp->ClientSocket.Connect("",40000);

            MessageBox("Connected to Socket Server!");

            char     bBuffer[10];
            strcpy(bBuffer,"Hi how r");

            res     =     pApp->ClientSocket.Send((BYTE*)bBuffer,10,0);
           MessageBox("Unable to Connect to Socket Server!");

The client successfully connects to the server as following msgs r

"Client Socket at port no. 40000 Successfully created!"
"Connected to Socket Server!"

Also call to Send() returns 10 as sizeof bBuffer is 10.

But the OnReceive() on the server side is never invoked, which proves that
the data is not received by the server.

waiting for suggestions

davinder1 (74)
3/21/2005 11:19:10 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 2

davinder wrote:
> The client successfully connects to the server as following msgs r
> displayed:
> "Client Socket at port no. 40000 Successfully created!"
> "Connected to Socket Server!"
> Also call to Send() returns 10 as sizeof bBuffer is 10.
> But the OnReceive() on the server side is never invoked, which proves that
> the data is not received by the server.
> waiting for suggestions
> Regards

You showed us the client code, which works, instead of the server code, 
which doesn't work.  Can't help you much without relevant information. 
Have you compared your code with the CHATTER/CHATSRVR MFC sample socket 

Scott McPhillips [VC++ MVP]

3/21/2005 1:37:43 PM

Similar Artilces:

Build Dynamic Query from Form
I am trying to build a dynamic Query from a Form. I keep getting an error that reads ‘Object qryFilter already exists’ I suspect it has something to do with the string of dates being passed to the Query; strDateCondition = "([Trades].[TDATE] Between [Forms]![SearchForm]![cboFrom] And [Forms]![SearchForm]![cboTo])" I am trying to add a means for a user to Query by Customer and Trader AND all records between two dates. This was working fine for Customer and Trader; when I added in the code to filter by dates I started having problems. I know the SQL will be li...

Two mailboxes for one user account after mailbox moved to a new server
After moving a user's mailbox from a Exchange 2003 to a new Exchange 2003 server, Outlook has listed two mailboxes with same name in the "All Mail Folders"area. The Outlook profile only has the user mailbox and no other mailboxes added to it. The user can send and recieve email just fine. The mailboxes seem to be clones of each other. New mail show up in the mailboxes at the sametime. How can I get Outlook to only show one mailbox? Any help would be appreciated, thanks, ...

chart label reference based on the column number
In a worksheet with an embedded chart, I have a cell, S4, where I enter the number of the column I want to chart (these numbers are listed as labels in cells A2:R2). I can't figure out how to translate the number in S4 into the corresponding column letter. For example, if S4 contains "3", the chart title should be =$C$2. I think working with absolute references, R1C1, might be easier here, but somehow what I've tried, didn't work (the entire spreadsheet is based on relative addresses (A1). z.entropic in a cell (Z100) put =index(A2:G2,1,S4,1) Change G2 to whatev...

Money 2006 file repair application error
I cannot delete an old account because I get a "file may be courrupt" error so I am trying to repair my 2006 file. Following the deirections, when the progress bar almost completes, I get an application exception and send an error report to MS. My event log has 2 app errors 1) Event Type: Error Event Source: Application Error Event Category: None Event ID: 1001 Date: 4/12/2006 Time: 10:47:26 PM User: N/A Computer: xxx Description: Fault bucket 02266399. For more information, see Help and Support Center at Data: 0000: 42 75 63 6b 65 ...

How many Server-side rules can you put on one mailbox?
I am using Exchange Server 2003 and want to setup 52 rules on one of the mailboxes, is this possible? the hardcoded limit on space for rules is 32K...i doubt you'll be able to get 52 rules on one mailbox... -- Susan Conkey [MVP] "jmareel" <> wrote in message > I am using Exchange Server 2003 and want to setup 52 rules on one of the > mailboxes, is this possible?;en-us;147298 -- Bharat Suneja MVP - Exchange www.zenpris...

Application hanging on file load...
Okay, I'm having the strangest problem, and I'm hoping somebody here will be able to give me an idea of how to attack it... I have an MFC application that does some networked communication, multi-threading, fun stuff... I also load and save xml configuration files. Now, on most of the computers I've run my software on, I have absolutely no problems. On SOME boxes, however, whenever I use my menu to try to load or save a file... before the File Dialog box even comes up... the application hangs. All the boxes I've tried this on have been Windows 2000 boxes with Service Pack 4....

Does a 'grace period' exist for Server CALs??
I am presently planning a new Win2k8 R2 DC/TS/AD/DNS server install. I know the TS/RDS CALs have a "grace period" which allows me time to obtain however many additional CALs we need. Does a similar "grace period" exist for the Server CALs per se?? If I don't have enough Server CALs (device) at the time of setting up the server and people's computers connecting to it via Terminal Services/Citrix, what will happen?? I haven't found anything searching the Internet... Thank you, Tom Hello tom12010, See here about the grace periods depending ...

please help with this query
Ost Ocity Dstate Dcity Carrier Price Rank Diff A B C D X 1200 1 100 A B C D Y 1300 2 100 A B C D Z 1350 3 100 A B C D W 1789 4 100 A1 B1 C1 D1 X1 785 1 A1 B1 C1 D1 Y1 789 2 The rank for every carrier is based on the price . If rank1 carrier is not a pariticular carrier(say if it is not X1 or Y1 or Z1), then i want to calculate the difference be...

gp10 change clients pointing to different server
In version GP 10 I have clients pointed to a test server. When production server is ready what do i do to point the clients to the production server e.g. GPServer. Would I change the odbc connection? Or Rerun the client installs? Any help is appriciated. Thank YOu As long as your production server has THE SAME level service pack as your clients and THE SAME third party products all you need to do is repoint your ODBC to the production server. Best regards, -- MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Business, LLC "2020" wro...

Cannot reinstall Exchange 5.5 on Small Business Server 4.5
Our Small Business Server 4.5 crashed yesterday and could only be started by doing a repair of Windows NT. Unfortunately, this left the Small Business Server programs partially installed. Now, Exchange will not start. It has the message "A connection could not be made to the Microsoft Exchange Server". I tried to reinstall Exchange, but get the message "This component is already installed and cannot be modified". Microsoft Exchange does not appear under Add/Remove Programs, so I cannot uninstall it either. Any suggestions would be greatly appreciated. Deborah obxgi...

Update Query
Access 2003 XP SP2 I am having a problem with an update query. Table is in a one-to-one relationship, referentail integrity and cascading data are checked. (The fileds I want to update are not in both tables) Table name= payForward Has 15 fields ie: ID, Name, MemID, Oct , Nov, Dec, etc Oct-Sep fields are yes/no type I want to "select" a field (Oct-Sep) via a query parameter and repalce "yes" with "no". Here is my query: UPDATE payForward SET [Enter month]=No The messages I get is 'operation must use an updateable query' Wh...

Rule to automatically mark header to download based on contact list?
Is there a way to do this, or an add-in? TIA. Rich On Tue, 26 Apr 2005 04:44:35 -1000, rmc <> wrote: > Is there a way to do this, or an add-in? What version of Outlook are you using? -- -Ben- Ben M. Schorr, MVP Hi Ben: 2003 SP1 Rich "Ben M. Schorr - MVP" <bens@bogusaddress.mvp> wrote in message > On Tue, 26 Apr 2005 04:44:35 -1000, rmc <> wrote: > > > Is there a way to do this, or an add-in? > > What version of Outlook are you using? > > > -- >...

7-bit and News Servers
Most of the messages that come here get the following news header fixed into them: Content-Transfer-Encoding: 7bit I recently (15:16 Eastern, 2010.06.02, Wednesday) looked through various messages and noticed that the following people no longer post 7-bit. From: "Larry Serflaten" <serflaten at usinternet dot com> References: <> Subject: Re: Instr problem in VB5 Date: Wed, 2 Jun 2010 14:12:35 -0500 Lines: 15 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1983 X-...

removing first exchange server in org
I am ready to move the first exchange 2k3 server from my organization. I have followed the steps in article 822931 and finished them. I am just noticing that one of the public folders - entitled system configuration - is not covered in the instructions in 822931 and is set for replication between the source(server being taken out)and destination server. Should i remove the source server or does it matter. Thanks ...

MFC Basics
Hello Group. I'm starting with MFC then I have a question I first try to make a simple login. But when login OK I want to system open another dialog How to make this like a Dialog.Show() ?? What commands I need to use to open another dialog ? Regards Smith You can open the second dialog the same way as you did the first one. If you want the first dialog to hang around, open it in its OK hander. You can use DoModal to open a modal dialog. For modeless, you can use ShowWindow to show/hide the dialog. --------- Ajay kalra Leo Smith wrote: > Hello Group. > ...

MFC DLL Dialog Box
Hello All, I am trying to link a MFC DLL to a MFC executable. The MFC DLL has a dialog template in it and has one entry point function in it. Dialog box template has the corresponding class as CLoadDlg. >From the executable I call the entry point function. Everything is working fine till this point. Now in entry point function I am creating a dialog box object and trying to display the dialog box (by calling DoModal). But this is not working and I see an assertion failure. Can someone give me some hints on how to get this dialog box up from the DLL. In DLL: ======= extern "C" ...

Rounding generated on funds application
We are finding that an incorrect rounding entry is being created when we apply a cash receipt against a receivables invoice. The rounding amount generates an entry something like: DR AR 13,317.05 CR Rounding 13,317.05 We would have expected the rounding to be in the pennies, not thousands. The rounding amount almost equals the total amount of the invoice. The invoice & payment both balance in the functional currency without this additional rounding entry being created. Any idea how to prevent this from happening? We're having to do a journal entry to back this out each time it hap...

Currency Format Lost in Union Query
Thanks to John Spencer, I resolved one problem in my union query (Thank you, John). But I have another problem. Some of my fields in my union query are currencies and others percents. I see both formats are lost. I am sure it is a union query problem, because when I ran an individual query, none of the formats were lost. Is there any way I can keep currency and percent formats without writing, FORMATCURRENCY, etc for each field? Thank you. What data types are these fields? The field in a UNION query will normally take on the data type of the field in the first SELECT. So, if ...

Common uses for XML in an asp web application
I recently created an application that used an xml file to define 4 different groups used for my app, and within each of those groups are <item></item> tags to declare different values that were used to lookup values in a database. This worked pretty well to allow me to dynamically create navigation buttons to perform operations etc.. Now i am trying to think of other common uses for xml that would make my apps even more scalable. I think I could have used xml again in my app for this operation althought i did not because of time constraints: Once records were grabbed from the d...

how to set up a query
I am using sql server 2005 express and have 3 tables Table1 Dept_Id (primary key) Dept_Name Table2 Employee_Id (primary key) Dept_Id (foreign key with table1) Employee_Name Table3 WorkSchedule_Id (primary key) Employee_Id (foreing key with table 2) Date_To_Work (date type) I want to list all the Departments (Dept_Name) that do not have anyone scheduled to work on a particular date (ie '1/20/2010' ) Any help would be appriciated. Thanks in advance, RABMissouri2010 Try this: SELECT dept_name FROM Table1 AS D WHERE NOT EXISTS(SELECT * ...

Utility to process rules based on message receive times?
Hi, Does anyone know of a utility that will check a mailbox and process Outlook rules based on how long a message has been in an inbox, and/or remained unread? Thanks! Jeff Yes, there is at least one - Auto-mate. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Need Help with Common Tasks? Outlook 2007: Outlook Tips: Outlook & Exch...

copy & insert based on criterial
When Department changes I need to insert the ADDRESS below the Account-Institution Business Office:. Another option I have is that if address = get new address from page 2. HELP xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ending 02/13/10 Account-Institution Business Office: DEPT EMP.NBR EMPLOYEE NAME ADDRESS 883 27903 ROBERSON, JOE abc 883 119245 MUSIL, TODD E abc 883 Total ----------------------------------------------------------------- Account-Institution Business Office: DEPT EMP.NBR EMPLO...

Excel comparative query
I'm respectfully requesting assistance with the correct formula to use for the following query: I'd searching all of column A on spreadsheet 1 to see if a value in column A of spreadsheet 2 is there, and placing a result X (or another) next to (adjacent cell) the confirmed value on spreadsheet 2. Please help if you can. Chris Hi Chris see your answer in puclic.excel -- Regards Frank Kabel Frankfurt, Germany Chris wrote: > I'm respectfully requesting assistance with the correct formula > to use for the following query: > > I'd searching all of column A on ...

"tcp/ip connection unexpectedly terminated by server"
i've been getting this message when i try to send and receive emails on outlook along with error number Ox800cccOf. can anyone help me fix this problem? ...

Getting all Sproc through one query
Hi all, can anyone help in getting below information from all stored procedure from one DB we have 100 procedure in one DB of sql server 2005.instead if of manully getting info for each procedure i want all below details in one shot or one query Procedure Name : Input Parameter : Output Parameter : Called By : Calls : Dependent tables : Thanks in advance ...