|
here is the member funtion ----
int getServer::getInfo()
{
ifstream ifile(path);
if(ifile)
{
ifile.getline(sss, 80);
sockVersion = MAKEWORD(1, 1);
WSAStartup(sockVersion, &wsaData);
listeningSocket = socket
(
AF_INET,
SOCK_STREAM,
IPPROTO_TCP
);
if (listeningSocket == INVALID_SOCKET)
{
nret = WSAGetLastError();
reportError(nret, "socket()");
WSACleanup();
return NETWORK_ERROR;
}
serverInfo.sin_family = AF_INET;
serverInfo.sin_addr.s_addr = inet_addr(sss);
serverInfo.sin_port = htons(23571);
nret = bind(listeningSocket, (LPSOCKADDR)&serverInfo, sizeof(struct sockaddr));
if (nret == SOCKET_ERROR)
{
nret = WSAGetLastError();
reportError(nret, "bind()");
WSACleanup();
return NETWORK_ERROR;
}
nret = listen(listeningSocket, 10);
if (nret == SOCKET_ERROR)
{
nret = WSAGetLastError();
reportError(nret, "listen()");
WSACleanup();
return NETWORK_ERROR;
}
theClient = accept
(
listeningSocket,
NULL,
NULL
);
if (theClient == INVALID_SOCKET)
{
nret = WSAGetLastError();
reportError(nret, "accept()");
WSACleanup();
return NETWORK_ERROR;
}
byteRece = recv(theClient, st, 100, 0);
if (byteRece == SOCKET_ERROR)
{
nret = WSAGetLastError();
reportError(nret, "send()");
WSACleanup();
return NETWORK_ERROR;
}
MessageBoxA(NULL, st, "Server Status", MB_OK | MB_ICONEXCLAMATION);
closesocket(theClient);
closesocket(listeningSocket);
WSACleanup();
return NETWORK_OK;
}
in ip.txt, if i put the ip --- 127.0.0.1 for same pc, it works or if i set the instruction ---
serverInfo.sin_addr.s_addr = INADDR_ANY;
if i put an ip address of other pc in the network, then bind() shows an error -- 10049. the ip is like 192.168.250.201.
|
|
|
|
|
serverInfo.sin_addr.s_addr = inet_addr("127.0.0.1");
...
nret = bind(listeningSocket, (LPSOCKADDR)&serverInfo, sizeof(struct sockaddr));
It is common sennse always succeeds above.
But,
serverInfo.sin_addr.s_addr = inet_addr("192.168.250.201");
...
nret = bind(listeningSocket, (LPSOCKADDR)&serverInfo, sizeof(struct sockaddr));
will succeeds only when this server program is executed on the pc which has IP address '192.168.250.201' exactly.
Note that bind() address is not client address but server address. So you cannot choose client by bind() and you should check accept()'ed client address by means.
Another situation, you have some local IP address and global IP address 10.0.0.1 by PPPOE, you may not wait for connection on 10.0.0.1 usually, because 10.0.0.1 address is owned by a router which connecting another network. Then you should wait on your local IP address and make change the router settings, for example DMZ or static routing, which 10.0.0.1 in-bound packets can route to your local IP address. In this case, in fact, it is not a programming issue but the network setting issue.
|
|
|
|
|
thanks.
can u tell me how to set the accept() function for getting the ip address of client ?
i tried but no result.
|
|
|
|
|
sockaddr_in clientAddress;
int clientAddressLen = sizeof(sockaddr_in);
SOCKET clientSocket= accept(linteningSocket, (sockaddr*)&clientAddress, &clientAddressLen);
if (INVALID_SOCKET != clientSocket) {
printf("client from %s\n", inet_ntoa(clientAddress.sin_addr);
....
}
What do your program codes return above accept ? No result yet?
|
|
|
|
|
I created a Windows exploler kind of UI. In the right shell pan of the UI i tried to add A tabbed dialog control. Till this point i am fine. In one of that tab I am trying to open a different application. can any one help with any idea how to achive this....
thanks in advance....
birajendu
CyberG India
Delhi
India
|
|
|
|
|
what do you mean by open an application? Are you using some kind of automation or you just want to run the exe
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
birajendu wrote: can any one help with any idea how to achive this....
Which part, adding a tabbed dialog control, or opening a different application?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
birajendu wrote: n one of that tab I am trying to open a different application.
This doesn't really make sense. A different application is a different process space.
You can start an application using CreateProcess , but that process in case of a UI application will run in its own window.
Your question needs to be more specific.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Yes, I got you. Let me explain more clearly. I have a application name A, it should have a tabbed UI. In on of its tab I want to lunch another application suppose application B.
To achive this kind of UI what approach I need to take?
Thanks In advance.....
birajendu
SonicWALL
Bangalore.
India
|
|
|
|
|
I guess, it may be related to OLE just like one can embed excel functionality within Word Document. I haven't tried it, but this may be one of the solution to your problem.
|
|
|
|
|
Thanks for all of your replies...
My purpose solved.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
I am using Microsoft Visual Studio 6.00.
I derive a class from CScrollView. I have a scrollbar at view. After moving scrollbar I am take care of SB_LINEDOWN, SB_LINEUP, SB_PAGEDOWN, SB_PAGEUP messages. But when I rotate my mouse knob then scrollbar also gets moved.
My problem is I don't want to move scrollbar though I am rotating mouse knob.
Which message is passed when we rotate mouse knob?
Thanks in advance
Nikesh
|
|
|
|
|
Nikesh Jagtap wrote: But when I rotate my mouse knob then scrollbar also gets moved.
you mean mouse wheel? You can prevent it by overriding the WM_MOUSEWHEEL message..
|
|
|
|
|
I'm changing from very old developper studio 6 to alo old VS 2005.
In a workspace, I have several projects, which depend on each other.
With DS 6 a batch build was no problem.
VS 2005 seems to make different projects at the same time, so I get every time other errors, because libs from one project doesn't exist, but they are needed by other projects.
Does anybody know about a solution for that problem?
|
|
|
|
|
did you see here[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
ERROR_TOO_MANY_SECRETS 1381 (0x565)
Description
The maximum number of secrets that may be stored in a single system has been exceeded.
I try to copy the files form a ntfs partitionnn..
what does the above error mean?
Thanking you
Krish
|
|
|
|
|
What function is returning this error? What type of file are you trying to copy?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I tried with Google..
And some results says " try to copy encrypted files""
And some other says " Mal ware affected the system"
I formatted the system..Then my program works properly
Thanking u
|
|
|
|
|
Did you try Google? The first return was your CP post, the second has the answer.
|
|
|
|
|
I need to retrieve all the properties of a dll say
1. Component ID
2. File version
3. Language
4. Copy right information
5. Description.
These are the information available when I right click on a dll and check its version.
Can I have a code snippet which will rerieve all this information.
|
|
|
|
|
We can check the resource for no.2-no.5 but I don't know for no.1.
What is Component ID exactly? CLASSID or AppID? I cannot see that information by right click now.
Whatever classid or appid, you can search in file's resource, maybe.
|
|
|
|
|
Sorry if I landed in the wrong place, I could not see an Ada section...
I get all the strange jobs. So here we have a very large amount of Ada code, as dll, which I call from C++. When my C++ is running in debug mode, no problem. In release mode (yes, I have written here before about this) it finds a memory leak when doing new, gives me an access violation and crashes. I followed this carefully as advised by yourselves. There are no memory leaks whatsoever in my C++ - DevPartner says so and I think so too. However, my ada.dll has a leak. Aonix dlls always have leaks, in my experience, but little ones you can live with. This one is different. So I got a new Aonix compiler, 8.4 (yes, I would prefer Gnu but they won't give me it, so there) and rebuilt it. I got patch U2 for it, which is intended to stop it making memory leaks when calling external dlls. Well, this Ada calls some very old external Fortran dlls (don't I get the FUN jobs).
I have the very uncomfortable feeling I should get those Fortran dlls recompiled, but they are GFE.
Our wise and intelligent buying department did not get me a maintenance contract, so Aonix are not being very helpful.
Has anyone else seen this?
Is there a memory leak finder for Ada similar to DevPartner?
Is patch U2 no good?
-------------
Ave computer! Hackitura te salutat!
(I just made this up. Just to show you can hack Latin as well as C++.)
|
|
|
|
|
My advice is: rebuild all from scratch, saying bye bye to all the FORTRAN and Ada stuff.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello Friends
Do anybody of u knows the any web link where i can get all library files of openGl ?
Thanks in Advance
Regards
Yogesh
|
|
|
|
|
This will be what you are looking for [^]
|
|
|
|