|
long file_len;
ifstream myfile;
myfile.open(path);
myfile.seekg(0, ios::end);
file_len = myfile.tellg();
myfile.close();
------------------------------------------
variable file_len's value is file length.
|
|
|
|
|
hai all masters,
here is my problem.
i want to access a hardware device(server) through TCPIP.
i know its ip address, and i want to write an application(client) to access it. but i donot know the port number.
is there any way to access it with out knowing the port number?
if any more clarity is required, then i can provide.
please give your views on this.
thanks in advance.
|
|
|
|
|
chandu004 wrote: is there any way to access it with out knowing the port number?
Of course:
(1) choose randomly a port
(2) are you able to communicate with the device?
(3) if the answer is yes then you're a lucky guy.
(4) if the answer is no, goto point 1.
That's called Montecarlo TCP/IP .
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
|
|
|
|
|
thanks pallini,
of course i have tried that before posting it here. i tried from 0 to 10000. but no use
any way let me provide you more details such that, you can help me.
1.the device is access control system(card swipe system) in our office.
2.the vendor has provided his software, which will download the swpe logs to the PC.
3.for some reasons, i wanted to have my own software for that.
so, i did the following things.
1.i made a session in hyperterminal using tcpip with the device ip and default port number 23.
2.then the device responded with welcome note, version number and a login prompt at my hyperterminal.
3.so here, i under stood that, i have to provide some username and pwd.
so i tried to simulate the server(the device) through my application and communicate with his software and find the username and pwd.
but the application is unable to communicate with my simulator.
any ideas on this?
please excuse me members, if my post is a bit lengthy.
|
|
|
|
|
I was just kidding, of course. Why don't you issue the netstat command (from command prompt) while the device is connected with vendor software to see involved ports?
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
|
|
|
|
|
wov thats wonderful. i was exactly looking for such a tool.
but it gives me the results all at a time. not in real time.
i mean, if i start it, and then start his application from another system, then it(netstat) should show me the commands that got transfered from one port to other.
any way, i shall look into the options of it and get back to you.
or if you have any idea of such an application then please forward me its url.
thanks for the clue.
|
|
|
|
|
but how come did the device respond to my hyperterminal with port number 23?
any idea on this?
and more over, with other numbers it is not responding.
|
|
|
|
|
It accepts telnet connections. However maybe the vendor software uses another port to communicate.
Why don't you ask the vendor?
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
|
|
|
|
|
yes i tried that even,
but he said it is not possible so easily.
and he want to take his own time to give me the techical details.
but iam not sure about him.
|
|
|
|
|
netstat could not give me the exact information that iam looking for.
can you suggest me any other idea to achieve my goal?
thank you.
|
|
|
|
|
Nope. Try the Hardware / Device Drivers [^] forum.
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 application gets minimized by a button and get added in task pane .on rt clicking the icon in task pane a menu appears tht doesnt hide on clicking anywhere on the screen.
Prabhat Singh
|
|
|
|
|
Owner-draw or standard menu?
System menu or user-tracked pop-up menu?
If it's owner draw, have you checked to see that you're calling ReleaseCapture to give the mouse back to the rest of the system?
Also, check your code surrounding any OnMouseLeave events or OnMouseOutOfWindowForTooLong timer events.
S
|
|
|
|
|
|
You should not use the "append" mode while opening the file. Now, I can't give more detailed explanations because you didn't provide the code to open the file...
|
|
|
|
|
No, No, No, friend. He needs something else.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: No, No, No, friend. He needs something else.
Definitely: a good programming tutorial.
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
|
|
|
|
|
Someone has voted you 4 man. Now, how funny is that.
[add] Umm... A low vote for you. Let me attempting to adjust that. Man, the trolls are really out today. [/add]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: Someone has voted you 4 man.
Actually it's pretty high: Trolls have only one digit...
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
|
|
|
|
|
This is not the way to do it. Are you storing some information related to your program? In that case, have a look at WritePrivateProfileString[^] and GetPrivateProfileString[^]
(You have options to write and read Int as well. Just look at related methods.)
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
can you paste a snippet of your code here please
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
And please avoid deleting messages. It makes the entire thread useless. Nobody will beat you down for asking a question like that. You just did not know how to do it and that is not a problem at all.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
hello
how i will write code to compare between two simple programs (in semantic)written by c++
please if any one has idea ... help me
i want simple idea without using tree
|
|
|
|
|
If that's your homework then someone is pulling your leg ( having a joke wiht you )
You probably need to research the 'completion problem' to understand what you're up again. If you're a math oriented person then equip yourself with a good understanding of 'Turing's theory of computability' to explain to whoever told you to do this why it isn't a good idea.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|