Hi all!

Quick summary:

I'm attempting to shutdown a socket, but the framework that I'm inheriting an Interface from already contains an implementation of a "shutdown" method. Therefore, I am unable to call "shutdown" for the socket.


Longer Explanation:

How can I fix this? I originally tried looking for a namespace it may have been included under, but true to form for Microsoft, there is none (Although I imagine it's for C compatibility?)

Is there a way to prevent my code from looking in the base files for the the method? I can't override the base shutdown method as that's just pointless. I guess I could write a class to wrap the socket stuff up in, but that seems pretty pointless for what is at the end of the day, a very simple call.

Recommended Answers

All 4 Replies

You need to explain more fully. It sounds like this is really a C question, you appear to be calling a C API even if your program is written in C++.

Are you saying that you are trying to write you own method called shutdown but you still want to be able to call the shutdown method in the API? If so then just use a different name for your method.

No, neither are my libraries. The Winsock2.h file includes a "shutdown" to close off the socket and do internal cleanup.

My class inherits an API provided base class, which includes a method called "shutdown".

As such, I cannot change either class. This may be a C question, as Winsock2 is C based, I was hoping that C++ may have presented a solution as the problem is caused because of a class.

The simplified "problem" is:
I need to know if there's a way to call a C method from inside a class that has a method of the same name and I cannot change the name of either method.

The API I'm inheriting is FireBreath (C++ Based), for creating browser plugins. The API I'm calling, is the Windows Sockets API (C Based).

Please note this is not for public release but for an internal company project to allow the creator of a website to call a network service on the local machine.

I am going Web -> JavaScript (Calls) -> C++ Plugin (Communicates To) -> C# (Launches) -> WPF

If you could tell me how to do this in a single step from a javascript command, I would be most grateful ^^

A-ha well the answer is yes there is, pre-pend a ::

::shutdown(socketId);

this will call the method defined at the global scope (i.e. the one in the C WinSock2 API).

commented: Solution as requested, with example. Clear and concise. :) +9

That's what I couldn't remember! :D

Thanks =)

Oh how I wish I'd not switched over to .NET, I miss having to use my brain once in a while ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.