|
Whatever he does he os going to need to use open ports on the firewall or open some more. THats for sure.
As for being on seperate LANs it depends on the routing whether he can ping or not. Thats the frst thing to establish.
==============================
Nothing to say.
|
|
|
|
|
|
I find that the word 'client' can misguide you. The word 'application' can be better.
Let me re-explain this problem again.
I want to design a network application that can send and receive data using TCP protocol. Certainly, these application can listen the socket port if need.
The problem is that if two applications in two different LAN, without WAN IP because of FireWall, how to create TCP connection between these two applications.
Normally in different LANs, if one application as the server, it must have a WAN IP so the other application as the client can connect to it. But now these two applcation also do not have WAN IP, how to create the TCP connenctions?
I guess that the emule uses this way to transfer data between two clients with low ID. But I do not know how to achieve it.
|
|
|
|
|
I understand the problem. Your systems are not only behind firewalls, but also behind routers that do NAT (network address translation) [^]. So the systems can't be seen from the "outside".
One solution would be to design your software as usual and change the network setup on the side that has a listening 'server'. This requires that the client side knows the WAN IP of the server side. If that IP is not static (dynamically assigned), you need to register at a dynamic DNS service like DynDNS and update the IP when getting a new dynamic one (routers usually have an option to do this). So the client can determine the server-side IP using normal DNS queries. Even with a static IP, you must configure a port forwarding on the router at the server side. This will forward packets from the WAN to a specific port on the local server system and vice versa.
Pro: Your software can be written as usual (like any other network software).
Con: Router / firewall must be configured. That may be restricted by policies when used in companies.
Another option is writing a special service application hosted on a system that is accessible from all clients and performs some kind of data forwarding. You are right, Emule and other file sharing applications do so. The service application stores a list of all connected clients that can be queried. The clients can then pick up other systems from the list and communicate using the service application.
Pro: No router / firewall setup changing necessary.
Con: Requires definition of an own protocol and writing the service application.
|
|
|
|
|
Can you ping from one client to the other? If so a route is available and a socket can be opened. SPecify a port that is open on the firewall.
==============================
Nothing to say.
|
|
|
|
|
No. And can not open the port on the firewall for some reason.
|
|
|
|
|
Is the ping port blocked then?
If you cant open ports then I dont see how you can get any kind of custom IP comms round the network.
==============================
Nothing to say.
modified 16-Feb-12 7:05am.
|
|
|
|
|
Yes, but you would need to create a TCP server app that accepts messages from one client and forwards it to the other, and vice versa. It's just a mater of designing your own private message protocol and adding that to your client and server apps.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
yu-jian wrote: Is there a way to create TCP connection between two clients through server?
I am almost positive that this is the wrong forum for this question. You would probably get some responses from network administrators in the System Admin forum[^]. But since we are in an ocean of wrongness I'll throw you a lifebuoy.
If I understand you correctly... you have something like:
[Network A] [Network B]
\ /
[Dumb switch]
|
[Server]
It doesn't matter if my graph is wrong and you actually have multiple Layer 1 network switches/routers on segregated networks. If both networks are able to speak TCP with the server then; Yes you can use the server to route packets between the subnets. You would set the server as the 'Gateway' and setup some static routes[^]. If the server is running Linux... same thing... same route command[^].
Another option if you are able to use UDP rather than TCP would be Multicasting[^]
Also... there are alot of IFs ANDs and BUTTS (butt-heads too) when it comes to network questions. To get a definitive answer it would be better if you drew a network graph. If there are any Layer2/Layer3 devices between your server and sub-nets it complicates the issue; but only slightly.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi,
I need to convert simple text (string) into SHA1 using Windows Crypto API with Unmanaged C++. Is there anything related to this available?
Thanks and Regards,
|
|
|
|
|
|
Hi,
Thanks for your response, but I need example of SHA1 encoding using CryptoAPI. I am working on a project, which has requirement of CryptoAPI. I know about Hashlib++ but I dont want to use it due to project requirement.
Regards,
|
|
|
|
|
Hi,
This Microsoft example is actually using the SHA1 hash using the CryptoAPI functions.
Example C Program: Duplicating a Hash[^]
You should be able to easily modify it and remove the code for duplicating the hash. All you would need is the original.
Best Wishes,
-David Delaune
|
|
|
|
|
|
Hi all,
I am using fwrite to save some images in while loop.
so i a can increment the file in fopen..
like 1.raw,2.raw...3....10
As first paramater is taking const char*.
If i take as a CString i am not able to get.
I tried the below code
CString FileName = "D:\\"
sprintf_s(ch,"%d",i++);
FileName=ch;
FileName+=".raw";
FileName=str+FileName;
then converted CString to char*
const TCHAR* cstr = (LPCTSTR)FileName;
It is showing as bad pointer
Is there any other way to increment the file name and save all images
Here is the Below code:
FILE *fp_ara;
while(1)
{
fp_ara=fopen ("D:\\1.raw","wb");
fwrite(Data,2,1024*1024,fp_ara);
if(fp_ara == NULL)
exit(1);
fclose(fp_ara);
}
Thank you
Sharan
|
|
|
|
|
me think you are over-complicating things.
how about something like :
for (int i = 0; i < numberOfFile; i++ )
{
CString filename;
filename.Format("c:\\path\\to\\file\\%i.raw", i);
FILE* fp = fopen( filename, ... );
fclose(fp);
}
Watched code never compiles.
|
|
|
|
|
I would like to add here that by default the unicode version of CString will be used.
This means that you're mixing unicode and non-unicode strings in your code.
This will not give you the desired results.
If you only want non-unicode characters, you can use CStringA instead of CString .
If you want unicode characters, then you will need to change const char* to const wchar_t* , fopen to wfopen and prefix strings with L (L".raw" ).
|
|
|
|
|
Hi!
While running my application,the execution pointer goes to the following line in the file xstring and crashes.
int __CLR_OR_THIS_CALL compare(const _Myt& _Right) const
{
return (compare(0, _Mysize, _Right._Myptr(), _Right.size()));
}
How to fix this crash?
|
|
|
|
|
it's impossible for anyone here to say. we need more information.
how are you calling compare ?
|
|
|
|
|
some times it crashes to a file called xhash in "Microsoft Visual Studio/VC/include" path. The execution pointer points to the following line:
inline iterator _Get_iter_from_vec(const _Myvec_value_type &_Iter) const
{
return _Iter;
}
Following is the call graph contents:
winRTSimpleApp.exe!stdext::_Hash<stdext::_Hmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,Variant *,stdext::hash_compare<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,Variant *> >,0> >::_Get_iter_from_vec(const std::list<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,Variant *>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,Variant *> > >::_Iterator<0> & _Iter={...}) Line 279 + 0x3 bytes C++
winRTSimpleApp.exe!stdext::_Hash<stdext::_Hmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,Variant *,stdext::hash_compare<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,Variant *> >,0> >::lower_bound(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Keyval="visible") Line 599 + 0x1f bytes C++
winRTSimpleApp.exe!stdext::_Hash<stdext::_Hmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,Variant *,stdext::hash_compare<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,Variant *> >,0> >::find(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Keyval="visible") Line 579 + 0x10 bytes C++
winRTSimpleApp.exe!VariantDB::GetVarIfExists(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & keyName="visible") Line 40 C++
winRTSimpleApp.exe!VariantDB::GetVar(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & keyName="visible") Line 69 + 0xc bytes C++
winRTSimpleApp.exe!Entity::GetVar(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & varName="visible") Line 72 + 0x35 bytes C++
winRTSimpleApp.exe!checkCollision(VariantList * pVList=0x0c9a8900) Line 113 + 0x3a bytes C++
winRTSimpleApp.exe!boost::detail::function::void_function_invoker1<void (__cdecl*)(VariantList *),void,VariantList *>::invoke(boost::detail::function::function_buffer & function_ptr={...}, VariantList * a0=0x0c9a8900) Line 111 + 0x9 bytes C++
winRTSimpleApp.exe!boost::function1<void,VariantList *>::operator()(VariantList * a0=0x0c9a8900) Line 989 + 0x17 bytes C++
winRTSimpleApp.exe!boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >::operator()<boost::signals::detail::connection_slot_pair>(const boost::signals::detail::connection_slot_pair & slot={...}) Line 120 C++
winRTSimpleApp.exe!boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator>::dereference() Line 61 + 0x1b bytes C++
winRTSimpleApp.exe!boost::iterator_core_access::dereference<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator> >(const boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator> & f={...}) Line 517 C++
winRTSimpleApp.exe!boost::iterator_facade<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator>,boost::signals::detail::unusable,boost::single_pass_traversal_tag,boost::signals::detail::unusable const &,int>::operator*() Line 634 + 0xe bytes C++
winRTSimpleApp.exe!boost::detail::postfix_increment_proxy<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator> >::postfix_increment_proxy<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator> >(const boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator> & x={...}) Line 145 + 0x2b bytes C++
winRTSimpleApp.exe!boost::operator++<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator>,boost::signals::detail::unusable,boost::single_pass_traversal_tag,boost::signals::detail::unusable const &,int>(boost::iterator_facade<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator>,boost::signals::detail::unusable,boost::single_pass_traversal_tag,boost::signals::detail::unusable const &,int> & i={...}, int __formal=0) Line 734 C++
winRTSimpleApp.exe!boost::last_value<void>::operator()<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator> >(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator> first={...}, boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<VariantList *,boost::function<void __cdecl(VariantList *)> >,boost::signals::detail::named_slot_map_iterator> last={...}) Line 49 + 0x12 bytes C++
winRTSimpleApp.exe!boost::signal1<void,VariantList *,boost::last_value<void>,int,std::less<int>,boost::function<void __cdecl(VariantList *)> >::operator()(VariantList * a1=0x0c9a8900) Line 354 + 0xbb bytes C++
winRTSimpleApp.exe!MessageManager::Deliver(Message * m=0x0c9a8888) Line 253 C++
winRTSimpleApp.exe!MessageManager::Update() Line 286 C++
winRTSimpleApp.exe!BaseApp::Update() Line 181 C++
winRTSimpleApp.exe!App::Update() Line 225 C++
winRTSimpleApp.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x001d3560, int nCmdShow=1) Line 1019 + 0x20 bytes C++
winRTSimpleApp.exe!__tmainCRTStartup() Line 263 + 0x2c bytes C
winRTSimpleApp.exe!WinMainCRTStartup() Line 182 C
kernel32.dll!768ded6c()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!778537f5()
ntdll.dll!778537c8()
winRTSimpleApp.exe!boost::signals::detail::bound_objects_visitor::decode<TyperComponent *>(TyperComponent * const & t=, long __formal=1946221693) Line 92 + 0x10 bytes C++
f87d83f8()
|
|
|
|
|
hi every body am back .
how can i load the image by using picture control in an SDI and even in dialog box Application .
thanking you
sarfaraz
|
|
|
|
|
If you have added a picture control to your dialog using the dialog editor, gave that control an ID (it is initialized with IDC_STATIC ) and add a CStatic member variable for the control to your dialog class.
Then load the bitmap from your resources from within OnInitDialog() :
m_staticPic.SetBitmap(::LoadBitmap(NULL, MAKEINTRESOURCE(OBM_PIC1)));
See also CStatic::SetBitmap in the MFC library reference [^].
|
|
|
|
|
I have a C++ class that implements a interface (ErrorInterface), because of old design. My class don't uses one of the methods (reset) in this interface but I have added an empty implementation because I don't want the class to be abstract. When I build the project I get warnings "unused parameters 'error'". Can I remove this warning?
class ErrorInterface
{
public:
virtual void reset(ErrorType error) = 0;
};
void MyClass::reset(ErrorType error)
{
}
|
|
|
|
|
Either of the following methods will remove the warning -
void MyClass::reset(ErrorType)
{
}
OR
void MyClass::reset(ErrorType error)
{
error;
}
Or you can use the UNREFERENCED_PARAMETER macro which does the same as the second method -
void MyClass::reset(ErrorType error)
{
UNREFERENCED_PARAMETER(error);
}
|
|
|
|
|
|