|
Who can correctly answer the following nine questions:
1, c # code to change XAML
2, c # code to XAML Conversion
3, WPF nature of the interface
4, XAML's execution
5, XAML implementation level
6, WPF interface architecture
7, WPF interface design approach
8, WPF interface design methods
9, WPF interface design patterns
Want to give points for each answer, and if it will be better able to analyze in detail
modified on Monday, May 3, 2010 3:10 AM
|
|
|
|
|
if nobody can help me answer the questions,then I should do it by myself...
|
|
|
|
|
I use VC + +6.0 write server code, when the listen (listener, 5); opened after listening into the loop
/ /
/ / Infinite loop to accept and deal with new connections
/ /
while (1)
(
/ /
clientAddressLength = sizeof (clientAddress);
newsocket = accept (listener, (struct sockaddr *) & clientAddress, & clientAddressLength);
/ /
...... The following is omitted
)
This approach, under the console no problem, but I wrote that the WIN32 Application, arrived in the implementation of accept (), the server will continue to the connection pool queue query, resulting in the absence of any connection, the phenomenon of the whole process stuck
Is there any way to exclude programs card dead?
(If you can understand why the same infinite loop program is not stuck under the console, while in windowed mode will be choked to death, it would be very grateful to you)
I use the completion port implementation, IOCP, seek expert help to solve the problem loop
Is not a while loop issue is the accept () function itself, an infinite loop check new link
accpet is blocked, one approach is another to open a thread devoted to it
Another approach is to set non-blocking mode
These two approaches are not very much will be
The first is to write I do not do:
unsigned long __stdcall foo (LPVOID param)
(
typedef struct (
HANDLE h;
SOCKET soc;
sockaddr * s;
int * inte;
SOCKET * returnsock;
) fo, * pfo;
pfo f = (fo *) param;
if (f! = NULL)
(
/ / Do ............
f-> returnsock = (SOCKET *) accept (f-> soc, f-> s, f-> inte);
)
delete f; / / here to delete
return 0;
)
SOCKET MyAccept (HWND hWnd, SOCKET sock, sockaddr * sa, int * inter)
(
typedef struct (
HANDLE h;
SOCKET soc;
sockaddr * s;
int * inte;
SOCKET * returnsock;
) fo, * pfo;
pfo f = new fo;
f-> h = hWnd;
f-> soc = sock;
f-> s = sa;
f-> inte = inter;
HANDLE tid = CreateThread (NULL, 0, foo, (LPVOID) f, 0, NULL);
if (! tid)
delete f;
else
:: ResumeThread (tid);
CloseHandle (tid);
SOCKET newsock = (SOCKET) f-> returnsock;
WaitForSingleObject (tid, INFINITE); / / wait for thread end of the
return newsock;
)
/ *
Additional I know of:
Now, I know accpet returns within a certain period of time, you can:
1, set to non-blocking, and then use select to determine isset (listenfd, & readfds).
2, can also be used WSAEventSelect register FD_ACCEPT event, and then set the wait timeout WSAWaitForMultipleEvents * /
|
|
|
|
|
oh,ok,I make it.the issue is resolved.
|
|
|
|
|
Oh,this site is very good.
And I love here.
|
|
|
|