Problem while sending Thru CAsyncSocket::Send()

Hi,

Iam using CAsyncSocket for let clients connect to my App.

Now I tried to send Data to the client.

After connecting from client is established i receive the READYTOSEND.



First I send the content of a textarea when clicked on a button like
this:

((CFCSDlg*)m_pWnd)->GetConnectSocket()->Send((LPCTSTR)
m_sCommand,m_sCommand.GetLength()+1);

Everything works well, even more than 1 time clicking the send button

Then I tried to send thru the socket on a function which is called
after receiving data.


    iSent = Send((LPCTSTR)Data, Len+1);    // Absenden der Daten
	if (iSent==SOCKET_ERROR)
                {AfxMessageBox("Server send error");

The result:

Unhandled exception at 0x004059c5 in FCS.exe: 0xC0000005: Access
violation reading location 0x000002dc.


What is the difference between Sending after click and by a function
after receiving?

Thanks in advance
0
4/1/2004 7:03:51 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
331 Views

Similar Articles

[PageSpeed] 48

Thorsten Viel wrote:
> Hi,
> 
> Iam using CAsyncSocket for let clients connect to my App.
> 
> Now I tried to send Data to the client.
> 
> After connecting from client is established i receive the READYTOSEND.
> 
> 
> 
> First I send the content of a textarea when clicked on a button like
> this:
> 
> ((CFCSDlg*)m_pWnd)->GetConnectSocket()->Send((LPCTSTR)
> m_sCommand,m_sCommand.GetLength()+1);
> 
> Everything works well, even more than 1 time clicking the send button
> 
> Then I tried to send thru the socket on a function which is called
> after receiving data.
> 
> 
>     iSent = Send((LPCTSTR)Data, Len+1);    // Absenden der Daten
> 	if (iSent==SOCKET_ERROR)
>                 {AfxMessageBox("Server send error");
> 
> The result:
> 
> Unhandled exception at 0x004059c5 in FCS.exe: 0xC0000005: Access
> violation reading location 0x000002dc.
> 
> 
> What is the difference between Sending after click and by a function
> after receiving?
> 
> Thanks in advance

There is no difference for the socket.  The error appears to be reading 
memory with a null pointer, so check your pointers, indexes and lengths. 
  The call stack in the debugger should show you exactly which variable 
caused the problem.

BTW, it is quite normal for Send to return SOCKET_ERROR sometimes, 
because winsock or the receiving machine can temporarily be busy.  Does 
you code detect this, and does it process the OnSend notification?

-- 
Scott McPhillips [VC++ MVP]

0
scottmcp8856 (490)
4/2/2004 12:28:13 AM
Reply:

Similar Artilces:

Browser history problem
Hi all Browser history only populates for 2-4 days instead of the 21 days setting. Have deleted history and/or (everything), many times. Also uninstalled same hoping for it to automatically reinstall correctly if corrupted, but still no joy. It used to work, but have lost track how long ago, so system restore does not help. I do not have Norton installed. Am running IE7.Win xp sp3. Appreciate any helpful response. This is not a real problem but would like to find the solution. TIA franktee Those with IE7- and/or IE8-specific questions or comments can post to and seek suppo...

Two Problems
A B C D E F 02/11/04 042110*** 10:39:53 am 10:47:40 am 467 4 02/11/04 035564*** 11:21:47 am 11:22:10 am 23 1 02/11/04 035564*** 11:55:05 am 11:56:12 am 67 1 02/11/04 042110*** 05:27:28 pm 06:14:08 pm 2800 24 02/11/04 563*** 09:06:52 pm 09:07:35 pm 43 1 02/11/04 042110*** 09:09:02 pm 09:22:46 pm 824 4 02/11/04 042110*** 09:37:37 pm 10:43:39 pm 3962 17 02/11/04 568*** 09:43:30 pm 09:53:22 pm 592 3 02/11/04 042110*** 11:37:28 pm 12:34:18 am 3410 15 03/11/04 042110*** 12:40:50 am 01:01:56 am 1266 6 03/11/04 0641217*** 0...

E-mail Reply Problem !!!!!
Hi, I've got one Exchange Server 2003 (w/o SP1) in the network, all user is using Outlook 2003, when the user has sent out the mail via "Reply All", the field "TO" or "CC" only display local user E-mail Address but other E-mail Address doesn't not exist ??? I don't know the problem is in Exchange Server or Outlook. Please help and give me the solution. Tks a Lot !!!!! ...

Personalize problem
A friend of mine allowed someone to install Team Viewer on her computer yesterday. Now everything is messed up. I fixed most of the problems. One minor problem is trying to personalize her desktop. Before yesterday the Choose Desktop Background worked fine. Now all the pictures are the same even though when I hover the mouse pointer over a frame, I get the names of the different photos. When I click on a photo it appears as a desktop background but there is a vertical line close to the right margin and the color is not even. Can someone give me instructions on how to get thi...

Outlook 2000 compact pst problem
Dear all, My Outlook 2000 is running Internet Mail Mode, my pst file is now 1.2GB. I removed some mails and compact the file. The 'compact now' dialog box show 1 second and finished, but the file size did not reduce. Anyone can help me? On Tue, 29 Jun 2004 19:40:29 +0800, "Ho" <Ho@feungning.com> wrote: >Dear all, > >My Outlook 2000 is running Internet Mail Mode, my pst file is now 1.2GB. I >removed some mails and compact the file. The 'compact now' dialog box show 1 >second and finished, but the file size did not reduce. > >Anyone can ...

Excel cell problem #2
I have a workbook I have created (I am a novice), which for some reason, when I want to add or delete a cell in ANY column, I no longer have the option to shift cells up or down, it will only allow me to shift the entire row up or down. Anyone have any idea what I am doing wrong here? I have some formulas set up to keep counts for me, nothing real special. Thanks in advance. -- Thanks Steve Have you applied Data|filter to that worksheet? Try data|filter|show all (to see everything) then try it out. Steve wrote: > > I have a workbook I have created (I am a novice), which for so...

format problem importing quicken files from Bank
Hi I have Money 2001 never used it until today. I am in Italy and my bank allows me to export bank statement in a quicken file. However when I import it into money - money misreads the format and takes the first punctuation mark as the decimal point. i.e. the amount euro 1.234,56 imports as 1,23 euro's instead of one thousand euros. My regional settings are set to italian with , being the decimal and . being a separator - however money takes the first , or . as the decimal Any ideas on how to fix this? regards Ski ...

Even buying addition Office for Mac2004 doesn't solve excessive installations problem
I had Office 2004 (Student and Teacher Edition) installed on three Macs, my high school son's iBook, my G4, and my wife's iMac. The computers are all on an home network. My son's IBook hard drive died and I bought him a new Mac Mini. I re-installed Office from the same Student and Teahcer Edition on the new Mac Mini. (Student and Teacher Edition allows 3 installations.) When either my wife or my son attempted to launch an Office application when the other's computer is on, the second machine got the notice that the number of installations exceeded the number allowed by the...

How to send form data to tables programatically
Is there a way to programatically have a form update to the underlying tables? What I mean is... As a user types into a form, Access doesn't seem to actually send that data to the table (and thereby create autonumbers) until user moves on to another record. Is there a way to force that data to the tables (ie make the new records) while the user is still on the form? On Sun, 30 Dec 2007 11:33:02 -0800, markmarko <markmarko@discussions.microsoft.com> wrote: >Is there a way to programatically have a form update to the underlying tables? > >What I mean is... As a user ...

CAsyncSocket in Multiple Threads?
I am creating a thread for each socket my program is running. Each socket class is derived from CAsyncSocket. I have read articles that suggest I need a Window in each thread through which CAsyncSocket will present messages (such as OnConnect, OnReceive, etc.). If this is true, Can anyone tell me (or point me to a good article) how to create this window and associate it with the thread so I can process these messages? Thanks. That window is created by MFC magic. The key thing is you must use a UI thread, not a worker thread. And you must not pass a socket pointer across the thread bounda...

Sending Bulk Email to Customers
We have a 8000+ list of customers that we send out a newsletter to on a monthly basis. Is there a best practices to follow when sending that amount of data from our Exchange 2003 server? The email is about 200k in size and if we don't have to cut it down any further we would like to keep it. Our main goal is to conserve bandwidth as much as possible and also manage the NDR's so that we can update our contact list. We will consider 3rd party packages as well. Thanks all! --Adam On 15 Jan 2007 11:08:48 -0800, eckerle@gmail.com wrote: >We have a 8000+ list of customers that we...

Problem with Outlook
When i open my Great Plains 10, i received a message error of Microsoft, when i clisk on the option send report, automatic close Great plains. Who know the reazon ???????????? Actually it depends, allot of errors could cause this hang, most of those errors caused by the server connectivity, make sure that the link between the machine and the server is stable, and then disable the outlook link in the home page, if the error didn't resolve you may need to do more investigations using profile or DEXLOG. Let me know if you need any more help in this matter. Regards, -- Mohammad R. ...

problem with cost of stock shares
Couple of years ago for a stock in my portfolio, I transfered some shares from one account to another one by swapping shares for cash, i.e. shares went from account A to B, while cash went from account B to A in exchange. I recorded the transaction as "transfer in" for account B, so at that time, Money calculated the cost of the shares as the closing price of the stock on that transaction day. Unfortunately, the amount of cash that was used in the swap is NOT the same. With the shares sold this year, it's creating somewhat of a problem within Money with calculation of profit. It ...

Problem generating email address
I have Exchange2003 and Win2003 AD with about 20 child domains running. Now I am experiencing some problem. For one child domain, RUS runs fine and I actually manually did update on RUS. The child domain is located in different geograpgic place and working fine. One word, I don't see any system issue. I created a few new users' email a week ago, by going through the "Exchange Task" process. However, none of their email address is generated. I rebooted email server and child DC. Still the email address is not generated. Any help? Thanks Rick The email addresses a...

How to send images from a COM control/ASP?
Hi, I am re-designing a legacy ActiveX control. Our goal is to make it usable in legacy applications as well as in ASP pages. We have an interface funciton like this: STDMETHODIMP CXXXCtrl::ExportImage(VARIANT Destination, ImageFormatEnum ImageFormat) Now the first parameter can only point to a file. In theory, users can save the image into the web space then pass to browser; however, this is obviousely not practically if a web site has thounsands of visitors at the same time. Is it possible to pass the Response object into the first parameter? Anyone can give me some suggestions... appr...

Sending via secure SMTP suddenly stops working
Greetings, I'm experiencing a strange problem with outgoing email via secure SMTP. After working perfectly, suddenly I can't send mail any longer. Outlook says that the SMTP server does not support SSL (don't have the exact error message). Usually, changing to another SMTP port number (I have two alternate ports I can use) and rebooting fixes the problem. This problem only appears with Outlook and Outlook Express - not with any of the Mozilla mail clients, Mulberry, or Eudora. Any ideas? /POL Outlook Express and Outlook only support secure smtp on the deprecated port 46...

Send/Receive isn't transmitting e-mails from pop3 server
As far as I can trace, I downloaded XP SP2 and since then Outlook no longer can receive files from my pop3 server set-up. I removed XP SP2 and I still have the problem. I click on send/receive, it shows everything to work but e-mails are remaining on my internet e-mail server and not being transferred to Outlook. It was all working a few days ago.... Any advice? "Outlook 2000 SR-1 & Windows XP - Send/Receive" <anonymous@discussions.microsoft.com> wrote in message news:259401c4a996$dc144140$a301280a@phx.gbl... > As far as I can trace, I downloaded XP SP2 and si...

numbers formating problem
I type 10 I got 1 I type 11 I got 1.1 Where from this problem cames? This is not a formatting problem, the value is what you see; 1, not 10. Tools > Options menu, "fixed decimal" is selected. HTH. Best wishes Harald "barsha" <barsha@discussions.microsoft.com> skrev i melding news:A62D8395-FD84-40F3-A867-B391D5956A57@microsoft.com... > I type 10 > I got 1 > I type 11 > I got 1.1 > Where from this problem cames? > Hi Barsha, Try: Tools | Options | Edit and uncheck the fixed decimal option. --- Regards, Norman "barsha" <...

Problem about Visio 2003 installation
Hi, When I install Visio 2003, a problem is encounted. It asks me to set a path for the file:A5614101.CAB, although I can see that file in the CD root directory. It is really bizarre. My PC is a Pentium 4, HT, which has a Windows XP, SP2 has been installed. Could you help me? ...

X axis label problems...won't display
My x axis labels are very long, up to 70 characters. I wish I could shorten these, but they have already been published by previous authors. We have to use what was published. I can't get the entire text to show. I've tried changing the size of the font or the text direction. I've also tried resizing the plot area, but the amount of space allowed for the x-axis labels is fixed. I've made the plot area very small, and the text is still cut off at the exact same point when the plot area was larger. In normal view, I can see the entire text, but when it prints, it's ...

ESM 2003 Help Crash
Using any of the help screens in ESM 2003 causes ESM to crash. This is apparently a conflict with Exchange 2003 SP2 and IE7. Here's an article about it: http://searchexchange.techtarget.com/tip/0,289483,sid43_gci1233854,00.html Is there a fix, or is Microsoft planning fix? This is underway. -- This posting is provided "AS IS" with no warranties, and confers no rights. Dgoldman http://blogs.msdn.com/dgoldman "Dave B" <daveb@atgnet.com> wrote in message news:%23Jg6weoLHHA.1816@TK2MSFTNGP06.phx.gbl... > Using any of the help screens in ESM 2003 cau...

Row height problems
My default row height is 13.20, but everyone else in my office has a default of 12.75. I cannot even get on the same scale as them, mine goes up and down by .6 and theirs adjusts by .75 Our fonts are the same, and I can't find out where to change this. Just a guess... Do you use the same printer/printer driver? TimLeHew wrote: > > My default row height is 13.20, but everyone else in my office has a default > of 12.75. > I cannot even get on the same scale as them, mine goes up and down by .6 and > theirs > adjusts by .75 > Our fonts are the same, and I can...

Modify OU delegation problem
Hello, I am trying to remove the permission to delete computer accounts in a particular OU for a particular domain admin user. This is just a test setup but even when I selected the Deny next to delete and delete subtree and also the delete Group Objects the same admin can still delete everything from the same OU. On the other hand when I remove the list contents checkbox the same admin cannot see anything listed in the same OU therefore it works as desired. Any help pls thank you -- aconti ------------------------------------------------------------------------ aconti'...

An old problem revisited
Last week I upgraded from 32-bit WinVista to 64-bit Win7, requiring a clean install. When I reinstalled and launched Money Plus, I got the message to update to SP1 and the old problem of that update never completing, even after disabling all security measures or using safe boot mode. So I replaced my Money Plus program folder with the one from my image of the WinVista installation. Now when I open Money I do have version . . . 1415, but I'm also still getting the the reminder window urging me to update. Does anyone know how I get rid of that? ...

NDR and sending null
So how can I get my Exchange 2003 servers to send NDR's with a "Return-Path: <>" ??? Right now we are sending as postmaster@mydomain.com tia On 10 Jan 2006 11:04:19 -0800, "joedonato@gmail.com" <joedonato@gmail.com> wrote: >So how can I get my Exchange 2003 servers to send NDR's with a >"Return-Path: <>" ??? > >Right now we are sending as postmaster@mydomain.com > >tia That's what's supposed to happen. Did I miss something in that question? "Mark Arnold [MVP]" <mark@mvps.org> wrote in mess...