|
want a neutral code that binds my port to listen socket.
The neutral code should work like (INADDR_ANY(IPv4) or INADDR_ANY6)
In INADDR_ANY(IPv4), the code for listening to multiple network interface is :
sin.sin_addr.s_addr = htonl(INADDR_ANY);
I want the code to work in the following situation:
I have more than one network interface and address. When a request to connect arrives for a particular port, will it be served with code given bellow?
if (IN_iRequestType EQUALS IPV4)
{
stHints.ai_family = AF_INET;
}
else
{
stHints.ai_family = AF_INET6;
}
stHints.ai_socktype = SOCK_STREAM;
stHints.ai_flags = AI_NUMERICHOST | AI_PASSIVE;
getaddrinfo(NULL, szPort, &stHints, &pAI);
bind(hsocket, (LPSOCKADDR)pAI->ai_addr, pAI->ai_addrlen);
I would also like to have documents or any other net resources which supports the neutral code (code which supports both IPv4 and Ipv6)
Please help me to find out a solution for my issue.
|
|
|
|
|
Hi All,
When I link my project what all path compiler seraches for a dll which is being refered in my project. As far as I remember there are few specified paths where compiler does that.
Also lets say I have all my dll in some directory then where can I give path of that directory so that the compiler will search the dll from that.
I am using VC++ 6 compiler.
Thanks,
Vaibhav
|
|
|
|
|
If you want only MSVC6 to search for your directory then:
tools -> options -> directories -> "show directories for" -> executable files
Remember this will only work when running your app inside MSVC. I you want to find the directory any other way, you will have to tell windows wher to search by adding the path of your directory into system path $PATH.
|
|
|
|
|
Actually, I want windows to search it anywhere.. So how do I add the path of my directory where all dlls are kept into $PATH?
Let say dlls are in C:\My Directory\Dlls
Actually in my case Dlls are on a network path.
--------------
Vaibhav...
|
|
|
|
|
how i can get information about my hardware using WMI with visual c++
i need some samples or articles or sites
thanks
am
|
|
|
|
|
|
Hi,
As iam a beginer in database application using VC++, i couldn't overcome
an issue. " Help me out"
Iam connecting SQL database through "ODBC" connectivity, everything works
out at normal operation.
if the SQL engine is stopped, and if i try to connect, the SQL API throughs
the Message Box--promting some connection failure.
How to disable the Message Box?????
Help Me
Madhu
|
|
|
|
|
It is not a "messageBox", it's called "Assertion".
First set break-points in your program and run it debug mode. at one point you will find your code screwing up. copy the block of code and paste here and start your quesion afresh. and dont post a blunt message like this.
VuNic
|
|
|
|
|
Build your Application in RELEASE mode.
Warning: First understand the use of DEBUG mode. when an Assertion is thrown it says something has gone false.(wrong! ), so while developing always use DEBUG mode , so that it gives you warning about failed conditions. In your case, you said that when the server is down it throws an assertion. instread of just ignoring the assertion and moving to release mode, you implement try -catch() in your code. I mean to say "Exception handling". never ignore an assertion and bybass it.
Only after handling all the exceptions its advisable to move to release version,
good luck.
VuNic
|
|
|
|
|
Hi,
As iam a beginer in database application in VC++, i couldn't overcome
an issue. " Help me out"
Iam connecting SQL database through "ODBC" connectivity, everything works
out at normal operation.
if the SQL engine is stopped, and if i try to connect, the SQL API throughs
the Message Box--promting some connection failure.
How to disable the Message Box?????
Help Me
Madhu
|
|
|
|
|
Hi all
I get the Configuration for my application from the Registry. If i write the hostname-field(CEdit) into the Registry, only a few chars were be saved in the Registry. If i read the Registry-entry(eg. hostname), only the first letter were be printed. Do someone have an idea, what the problem is or better what i can do?
I'm really stumped...
and sorry for my english!
hopefull
simon
|
|
|
|
|
Sounds like you're reading UNICODE data but interpreting it as an ANSI string.
Steve
|
|
|
|
|
Before I set the CEdit field with the value, I put the value in a CString. Isn't CString an UNICODE string?
-- modified at 4:01 Tuesday 21st March, 2006
|
|
|
|
|
Yeah, a CString "knows" whether to be UNICODE or ANSI. Can you show the reading a writing code?
Steve
|
|
|
|
|
Ok, here is a link to my .cpp file: www.planetsite.ch/ccode/settings.cpp
-- modified at 8:40 Tuesday 21st March, 2006
- corrected the url
|
|
|
|
|
Ok, I really need to see settings.h and Registry.h.
Steve
|
|
|
|
|
I can't see what (if anything) you're doing wrong. I suspect the problem might be in the CRegistry class.
Steve
|
|
|
|
|
Hello Community,
i have a litle problem do make a file with unicode characters, ANSI is not a problem,
does any one have a example for this, or tut?
thanx
break;
|
|
|
|
|
Hi there,
*Unicode file* means? An app that is aware of unicode? For that, you need to add the following to your stdafx.h
#define _UNICODE
#define UNICODE
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Create the file with ::CreateFile , write the unicode text to the file with ::WriteFile and close it up with ::CloseHandle . Exactly the same as with ANSI characters, with the exception of wider characters, so that if you have
std::wstring text(L"Unicode text"); then write the data stream
text.data() which has the byte size
text.size() * sizeof(wchar_t) Was that what you meant?
Of course, there are abstractions that makes it easier to work with the Win32 file APIs. But grok the above and be a happier man.
--
The Blog: Bits and Pieces
|
|
|
|
|
Hello,
thax for answers, i try to make it!
regards
break;
|
|
|
|
|
Hi all,
I have an MDI application with multiple views (CScrollView, CFormView). Lets say there are five views opened (CScrollView -3, CFormView -2). There is a member "Child_Id" in the CScrollView class.
At one point of time - in the application class, I'd like to update (repaint) a CScrollView object with a given "Child_Id".
Give your hands please...
Thanks in advance,
Sarvan AL
|
|
|
|
|
You can take a look at the following functions...
CDocument::GetFirstViewPosition();
CDocument::GetNextView();
CMultiDocTemplate::GetFirstDocPosition();
CMultiDocTemplate::GetNextDoc();
Nibu thomas
Software Developer
|
|
|
|
|
I have a CString object loaded with a string like "This is the first section$This is the second section$This is the end" so each section separated by '$'. I try to load the second section as csAnsprech = csComboBoxText.Mid( csComboBoxText.Find( '$') +1, csComboBoxText.ReverseFind( '$')); but this retrieves the second and third section, nut just the second one. What´s wrong here ?
|
|
|
|
|
int nPos = csComboBoxText.Find( '$') + 1;
csAnsprech = csComboBoxText.Mid( nPos , csComboBoxText.GetLength()- csComboBoxText.Find( '$',nPos ));
nave
|
|
|
|