|
Using CSocket is a good option to get and handle notifications.
but we can't share the CSocket across threads, i.e we could not accept connection in one thread and this object could not pass to another thread for receiving data. since CSocket is designed to serve per thread basis. you may have to detach the handle and attach it for further use and also the connection close should be synchronized. This is FYI
-Sarath
|
|
|
|
|
Hi.
No, I'm not passing the socket object to another thread. The thread in the server create the socket and it's used inside this thread. There, the server, accept connections and there, it read and send data from/to clients according some variable state, and this is the logic that I asked for, because after accept the connection the thread start to send to client the names of the files of the machine where it runs, it works, but there are some bugs at client side, it looks like the server send the data faster than the client can read. Sometimes, in the client, I can see the names of the files comming but a CString object assert. That kind of issues happend.
For this I'm asking about my logic, there is something wrong with it.
Pressing a button in the client program it try to connect to server, meanwhile the server inside the thread, (inside the while), accept the connection and start a routine using CFileFind object and get the names of the files and it sends these strings to client. The client open a text file where save the info.
I know, it's hard to give an advice about "a logic" that you can't see.
Maybe I'm thinking the serve application like a program that read/write data in a comm port, that's why I have an infinite while with states, etc., because I have copied my logic used for a program that use Serial communication. I must to improve that.
Thank you very much for your time.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
HI,
I have Client and server application.
The machine on which Server is installed changes its IP frequently ( say after 2 OR 3 days)
I have my Client which needs to connect via internet to server app.
So how can I get the IP of Server on Client side to connect to it after a the change in server side IP.
Or How can my Server track the installed client on clients machine that may connects to internet thorugh dial up or other resource
Any idea / link
Thanks
Regards.
|
|
|
|
|
If your DNS is working properly, why not connect to the server via its host name?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Lets say when the server changes its IP it also changes its DNS , then what would be the solution,
actualy Server ( on which server side application is installed . and app is listening on socket lets say 3333 but server changes its IP ) is changing its IP for security reasons
Regards.
|
|
|
|
|
zahid_ash wrote: Lets say when the server changes its IP it also changes its DNS...
Of course the DNS entry (just the IP address) would change. That's what is supposed to happen. Otherwise, name resolution could not occur. Use gethostbyname() .
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
|
see the following API
hostent *gethostbyname(const char *hostname);
The structure hostent have the IP address of the Internet host specified by hostname.
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
Would it work for Internet , Lets say server is in USA. and client is in Russia
Is not it for Local network.?
Regards.
|
|
|
|
|
zahid_ash wrote: Would it work for Internet...Is not it for Local network.?
Why not try it and see exactly how it works?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
If you server is DNS then I think it should work.
For LOCAL as well as INTERNET
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
Subscribe to a dynamic DNS service.
You install an agent on the server, which is in sporadic communication with the server.
The dyamic DNS server will update the IP for the name you wish...
It's not a programming answer, but it works really well.
See http://www.oth.net/dyndns.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
How I can make the Monitor List control scroll down each time a new message pop up ?MFC application
|
|
|
|
|
HI,
I have the MFC application.
I want that its process "app.exe" should not be visible in prcoess tab of Task manager and also in application tab of Task manager
I want to do it on Win98 , XP, 2000 and NT
any Idea?
Thanks
Regards.
|
|
|
|
|
can you explain why?this is for previous question?
whitesky
|
|
|
|
|
I would not allow the user to kill the process.
I am doing it for learning purpose.
Regards.
|
|
|
|
|
zahid_ash wrote: I would not allow the user to kill the process.
http://www.codeproject.com/threads/taskex.asp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
It works when Task Manager Window is opened. else not
Would it work on Win98 ?
Regards.
|
|
|
|
|
zahid_ash wrote: It works when Task Manager Window is opened. else not
If the taskbar is not open then how will u see the process in task bar
zahid_ash wrote: Would it work on Win98 ?
I didn't test.
nave
|
|
|
|
|
Means to say that when Task manager window is open or have icon in task bar then it gets handle and hide the process
When task manager window is not open it fails and say Task manager not found ,
Please do a try ? it will make clear
Thanks
Regards.
|
|
|
|
|
ok i got it..
U can put a WH_SHELL hook( using SetWindowsHookEx ). Then when ever a window is been created, A funtion of ur will be called. U can check if it is Task manager. If so do as said in the Link that I give u..
nave
|
|
|
|
|
Hey there,
I want to be able to drag a line's position with the mouse. This means that I have to re-draw the line on every mouse-move. However, I must then of course erase the previous image of that line. Is there a way in having an XOR type of Pen or something?
Appreciate any comments.
William
-- modified at 8:04 Wednesday 17th May, 2006
|
|
|
|
|
One thing that you can do is that keep the coordinates of the line stored in some variable of POINT type. Then if a user clicks on that screen check if the clicked point falls on the line(You can use Bresenham's algorithm just to check this).IF the clicked point coincides with any point on the line drawn erase the previous line(ie draw a line with what the background color is.) and start drawing a new line or you if want to show the moving effect on the line you will have to do some more work man(similar to dragging).
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
If the line is drawn into the OnDraw /OnPaint function you have an easy work:
simply change into OnMouseMove the line position an then Invalidate() .
This will call the draw function that plots the line into the correct position.
An harder work is edit a Bitmap deleting the old line (putting there the default pixel colors) and re-draw the line in a different position.
But probally CDC::bitblt() could help you , because there are many binary and ternary raster operation that you could use.
|
|
|
|