473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Winsock try catch exceptions

Hi,

I use the Winsock ActiveX in VS C++.
the problem is that I am unable to catch all the exceptions.
for instance if I have a server who listens at port 1111 and I try to
connect to the wrong port or if the server is offline I get error
messagebox "connection is forcefully rejected". it seems that I can't
catch that message somehow.

here is the code I use:

TRY
{
WinSockControl.SetProtocol(0) ; // TCP/IP
WinSockControl.Connect(COleVariant("127.0.0.1"),
COleVariant(long(1321))) ;
}
CATCH(CException, e)
{
MSGDialog("ddddddddddddd");
e->Delete();
}
END_CATCH

Does anyone know how to catch everything?
Jul 22 '05 #1
2 2754

"Oren" <or**@fourier-sys.com> wrote in message
Hi, [snip] here is the code I use:

TRY
{
WinSockControl.SetProtocol(0) ; // TCP/IP
WinSockControl.Connect(COleVariant("127.0.0.1"),
COleVariant(long(1321))) ;
}
CATCH(CException, e)
{
MSGDialog("ddddddddddddd");
e->Delete();
}
END_CATCH

Does anyone know how to catch everything?


There is a lot of non-standard stuff in your post. Anyways you can catch all
exceptions this way -
try {
// ...
}
catch(...)
{
// ...
}

Sharad
Jul 22 '05 #2
I know.
I tried everything including:

try
{
WinSockControl.SetProtocol(0) ; // TCP/IP
WinSockControl.Connect(COleVariant("127.0.0.1"), COleVariant(long(1321))) ;
}
catch(CException e)
{
MSGDialog("ddddddddddddd");
}

and it catches nothing.
Do you have any other suggestions?

"Sharad Kala" <no*****************@yahoo.com> wrote in message news:<2u*************@uni-berlin.de>...
"Oren" <or**@fourier-sys.com> wrote in message
Hi,

[snip]
here is the code I use:

TRY
{
WinSockControl.SetProtocol(0) ; // TCP/IP
WinSockControl.Connect(COleVariant("127.0.0.1"),
COleVariant(long(1321))) ;
}
CATCH(CException, e)
{
MSGDialog("ddddddddddddd");
e->Delete();
}
END_CATCH

Does anyone know how to catch everything?


There is a lot of non-standard stuff in your post. Anyways you can catch all
exceptions this way -
try {
// ...
}
catch(...)
{
// ...
}

Sharad

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Gary.Hu | last post by:
I was trying to catch the Arithmetic exception, unsuccessfully. try{ int a = 0, b = 9; b = b / a; }catch(...){ cout << "arithmetic exception was catched!" << endl; } After ran the program,...
24
by: Steven T. Hatton | last post by:
If I understand correctly, I have no assurance that I can determine the type of a simple class instance thrown as an exception unless I explicitly catch it by name. (non-derived classes having no...
8
by: Z D | last post by:
Hi, I was wondering what's the point of "finally" is in a try..catch..finally block? Isn't it the same to put the code that would be in the "finally" section right after the try/catch block?...
9
by: Steven Blair | last post by:
Hi, I need to catch exceotions on File.Delete() After checking the help, I have noticed that thgere are serevral Exceptions that can be thrown. My question is, should I catch all thes...
13
by: Benny | last post by:
Hi, I have something like this: try { // some code } catch // note - i am catching everything now {
23
by: VB Programmer | last post by:
Variable scope doesn't make sense to me when it comes to Try Catch Finally. Example: In order to close/dispose a db connection you have to dim the connection outside of the Try Catch Finally...
9
by: Bob Achgill | last post by:
I really like this function but have tried to slow down on using it because I get a 1 second pause each time I use it. I don't really understand why the computer has to think for 1 second! ...
32
by: cj | last post by:
Another wish of mine. I wish there was a way in the Try Catch structure to say if there wasn't an error to do something. Like an else statement. Try Catch Else Finally. Also because I...
23
by: pigeonrandle | last post by:
Hi, Does this bit of code represent complete overkill?! try { //create a treenode TreeNode tn = new TreeNode(); //add it to a treeview tv.Nodes.Add(tn);
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.