Click here to Skip to main content
15,917,618 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to color a form in my MFC application Pin
saravana00111-Aug-07 1:57
saravana00111-Aug-07 1:57 
QuestionRe: How to color a form in my MFC application Pin
Hamid_RT11-Aug-07 7:31
Hamid_RT11-Aug-07 7:31 
Questiona very strange problem about socket Pin
kcynic11-Aug-07 1:50
kcynic11-Aug-07 1:50 
AnswerRe: a very strange problem about socket Pin
Mark Salsbery11-Aug-07 6:46
Mark Salsbery11-Aug-07 6:46 
GeneralRe: a very strange problem about socket Pin
David Crow11-Aug-07 12:40
David Crow11-Aug-07 12:40 
GeneralRe: a very strange problem about socket Pin
Mark Salsbery12-Aug-07 7:42
Mark Salsbery12-Aug-07 7:42 
GeneralRe: a very strange problem about socket Pin
kcynic11-Aug-07 18:45
kcynic11-Aug-07 18:45 
GeneralRe: a very strange problem about socket Pin
Mark Salsbery12-Aug-07 6:53
Mark Salsbery12-Aug-07 6:53 
kcynic wrote:
1. What is the member m_hSocket of the CAsyncSocket? And if I use Create()
to create a socket with a random port ,how can I get the port of the socket?


m_hSocket is a SOCKET - a handle to a socket.  To get the address assigned to
your socket, including the port, you can use GetSockName():
    if (MySocket.Create(0, SOCK_STREAM))
    {
       CString SockAddrStr;
       UINT port;
       MySocket.GetSockName(SockAddrStr, port);

       MySocket.Listen();
    }
"port" is the port number that other peers should connect to.  They'll need the
IP address as well.

Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: a very strange problem about socket Pin
kcynic12-Aug-07 9:59
kcynic12-Aug-07 9:59 
GeneralRe: a very strange problem about socket Pin
Mark Salsbery12-Aug-07 10:16
Mark Salsbery12-Aug-07 10:16 
GeneralRe: a very strange problem about socket Pin
kcynic12-Aug-07 10:32
kcynic12-Aug-07 10:32 
QuestionHow can fix linking errors? Pin
Armin Morattab11-Aug-07 0:36
Armin Morattab11-Aug-07 0:36 
AnswerRe: How can fix linking errors? Pin
karle12-Aug-07 7:30
karle12-Aug-07 7:30 
QuestionRetrieve static text from other application window Pin
Daboe_10-Aug-07 23:19
Daboe_10-Aug-07 23:19 
AnswerRe: Retrieve static text from other application window Pin
Peter Weyzen11-Aug-07 15:21
Peter Weyzen11-Aug-07 15:21 
GeneralRe: Retrieve static text from other application window Pin
Daboe_12-Aug-07 1:50
Daboe_12-Aug-07 1:50 
QuestionDialog Communication Pin
sofa_2006au10-Aug-07 22:12
sofa_2006au10-Aug-07 22:12 
QuestionRe: Dialog Communication Pin
Hamid_RT11-Aug-07 0:46
Hamid_RT11-Aug-07 0:46 
AnswerRe: Dialog Communication Pin
sofa_2006au11-Aug-07 2:22
sofa_2006au11-Aug-07 2:22 
QuestionRe: Dialog Communication Pin
Hamid_RT11-Aug-07 8:16
Hamid_RT11-Aug-07 8:16 
QuestionRe: Dialog Communication Pin
David Crow11-Aug-07 6:39
David Crow11-Aug-07 6:39 
AnswerRe: Dialog Communication Pin
Peter Weyzen11-Aug-07 15:24
Peter Weyzen11-Aug-07 15:24 
GeneralRe: Dialog Communication Pin
sofa_2006au11-Aug-07 16:21
sofa_2006au11-Aug-07 16:21 
GeneralRe: Dialog Communication Pin
Peter Weyzen11-Aug-07 19:02
Peter Weyzen11-Aug-07 19:02 
QuestionClosing a Dialog Pin
Sangeetha_J10-Aug-07 19:17
Sangeetha_J10-Aug-07 19:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.