⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multi-threaded client-server socket class - the code project - internet & network.mht

📁 多线程通信
💻 MHT
📖 第 1 页 / 共 5 页
字号:
                    =
href=3D"http://www.codeproject.com/internet/drvfltip.asp">Developing=20
                    Firewalls for Windows 2000/XP</A>
                    <DIV class=3DsmallText>An article about developing =
Firewalls=20
                    for Windows 2000/XP.</DIV>
                    <LI><A=20
                    =
href=3D"http://www.codeproject.com/internet/YourOwnSecureProtocol.asp">Bu=
ild=20
                    your own cryptographically safe server/client =
protocol</A>
                    <DIV class=3DsmallText>This article presents all you =
need to=20
                    implement your own secure protocol using variable =
keysize=20
                    RSA encryption/decryption, digital signing, multi =
precision=20
                    library, Diffie-Hellman key exchange, Rijndael, and =
more.=20
                    Everything is converged into a secure IOCP =
client/server=20
                    chat server.</DIV>
                    <LI><A=20
                    =
href=3D"http://www.codeproject.com/internet/csmtpconn.asp">CSMTPConnectio=
n=20
                    v1.36</A>
                    <DIV class=3DsmallText>An MFC class to encapsulate =
the SMTP=20
                    protocol.</DIV></LI></UL></TD>
                <TD width=3D360>
                  <SCRIPT language=3Djavascript>document.write("<IFRAME =
src=3D\"/script/ann/ServeHTML.aspx?C=3DFalse&id=3D2257&cb=3D2395024\" =
border=3D0 frameborder=3D0 scrolling=3Dno width=3D300 =
height=3D250></IFRAME>");</SCRIPT>
                </TD></TR></TBODY></TABLE>
            <FORM action=3D/script/rating/code/app/insert_vote.asp=20
            method=3Dpost><INPUT type=3Dhidden =
value=3DServerSocket/internet6/23/2002=20
            name=3Dvote_name> <INPUT type=3Dhidden =
value=3D/internet/serversocket.asp=20
            name=3Dgoal>=20
            <TABLE cellSpacing=3D0 cellPadding=3D1 width=3D"100%" =
bgColor=3D#ff9900=20
            border=3D0>
              <TBODY>
              <TR>
                <TD width=3D"100%">
                  <TABLE cellSpacing=3D0 cellPadding=3D4 width=3D"100%"=20
                  bgColor=3D#fbedbb border=3D0>
                    <TBODY>
                    <TR>
                      <TD class=3Dsmalltext vAlign=3Dcenter>[<A=20
                        =
href=3D"http://www.codeproject.com/internet/serversocket.asp#__top">Top</=
A>]</TD>
                      <TD vAlign=3Dcenter noWrap =
align=3Dright><I><B>Rate this=20
                        Article for us!</B></I>&nbsp;&nbsp;&nbsp;&nbsp;=20
                        <I>Poor</I><INPUT type=3Dradio value=3D1 =
name=3Drate><INPUT=20
                        type=3Dradio value=3D2 name=3Drate><INPUT =
type=3Dradio value=3D3=20
                        name=3Drate><INPUT type=3Dradio value=3D4 =
name=3Drate><INPUT=20
                        type=3Dradio value=3D5=20
name=3Drate><I>Excellent</I>&nbsp;&nbsp;<INPUT class=3DFormButton =
type=3Dsubmit value=3DVote>=20
                      =
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FORM>
            <CENTER>
            <TABLE cellSpacing=3D0 cellPadding=3D0 border=3D0>
              <TBODY>
              <TR>
                <TD=20
                style=3D"PADDING-RIGHT: 2px; PADDING-LEFT: 2px; =
PADDING-BOTTOM: 2px; PADDING-TOP: 2px; BACKGROUND-COLOR: #eee"=20
                width=3D120 height=3D60>
                  <DIV align=3Dcenter>
                  <SCRIPT language=3Djavascript>document.write("<a =
href=3D\"/script/admentor/admentorredir.asp?id=3D3024&way=3Dban\" =
target=3D_blank><img =
src=3D\"/script/ann/ServeImg.aspx?File=3D%2Fscript%2Fadmentor%2Fimages%2F=
Dundas%5F120x60%2Egif&C=3DFalse&id=3D3024&cb=3D2395030\" alt=3D\"\" =
border=3D0 width=3D120 height=3D60></a>");</SCRIPT>
                  </DIV></TD>
                <TD width=3D100>&nbsp;</TD>
                <TD width=3D468 height=3D60><SPAN id=3DAdBanner5>
                  <SCRIPT language=3Djavascript>document.write("<a =
href=3D\"/script/admentor/admentorredir.asp?id=3D3524&way=3Dban\" =
target=3D_blank><img =
src=3D\"/script/ann/ServeImg.aspx?File=3D%2Fscript%2Fadmentor%2Fimages%2F=
VB6%5FInterop%5F468x60%2Ejpg&C=3DFalse&id=3D3524&cb=3D2394972\" =
alt=3D\"\" border=3D0 width=3D468 height=3D60></a>");</SCRIPT>
                  </SPAN></TD></TR></TBODY></TABLE></CENTER><A =
name=3D__comments></A>
            <SCRIPT language=3DJavaScript>

function MsgVoteForm(MemberID, MsgID)
{
	document.write("<span id=3D\"MVF" + MsgID + "\">");
	document.write("Rate this message: ");
	for (var i=3D1; i<=3D5;i++)
	{
		document.write("<a href=3D'#xx" + MsgID.toString() + "xx' =
title=3D'give this message a vote of " + i.toString());
		document.write("' onclick=3D'return RateMsg(" + MemberID.toString() + =
", " + MsgID.toString() + ", ");
		document.write(i.toString() + ")'><b>" + i.toString() + "</b></a> ");
	}
	document.write(" (out of 5)");
	document.writeln("</span>");
=09
	document.write("<br />Report as <a href=3D'#xx" + MsgID.toString() + =
"xx' title=3D'Mark as Spam' onclick=3D'return ReportMsg(" + =
MemberID.toString());
	document.writeln(", " + MsgID.toString() + ",-1)'>Spam</a> or ");
	document.write("<a href=3D'#xx" + MsgID.toString() + "xx' title=3D'Mark =
as Abuse' onclick=3D'return ReportMsg(" + MemberID.toString());
	document.writeln(", " + MsgID.toString() + ",-2)'>Abuse</a>");
}

function RetypeForm(MemberID, MsgID)
{
	var types =3D [
				 {pic:'news_general.gif',  id: 1},
	             {pic:'news_info.gif',     id: 2},
	             {pic:'news_question.gif', id: 4},
	             {pic:'news_answer.gif',   id: 8},
	             {pic:'news_game.gif',     id: 16},
	             {pic:'news_spam.gif',     id: 32}
	            ];
=09
	document.write("<span id=3D\"RTF" + MsgID + "\">");
	for (var i=3D0;i<types.length;i++)
	{
		document.write("<a href=3D'/script/comments/retype?msg=3D" + =
MsgID.toString());
		document.write("&mid=3D" + MemberID.toString() + "&type=3D" + =
types[i].id + "'>");
		document.write("<img border=3D0 src=3D'/script/images/" + types[i].pic =
+ "'></a><br />");
	}
	document.writeln("</span>");
}

function ReportMsg(userid, msgid, score)
{
	if (confirm("Are you sure you want to report this message?") =3D=3D =
true)
		return RateMsg(userid, msgid, score);
	else return false;
}


function RateMsg(userid, msgid, score)
{

   var req =3D new ActiveXObject("Msxml2.XMLHTTP");=20

   req.onreadystatechange =3D function()
   {
      if ( req.readyState =3D=3D 4 )
      {
         if ( req.status =3D=3D 200 )
         {
         	var respText =3D req.responseText;
         	var re =3D new RegExp("\<div\>([^\<]*)\</div\>", "g");
         	var match =3D re.exec(respText);
         	status.innerHTML =3D "<b>" + (match)?match[1]:"An error =
occured" + "</b>";
         }
         else
         {
            status.innerHTML =3D "<b style=3D'color:red'>Failed!" + =
req.statusText + "</b>";
         }
      }
   }
  =20
   var status =3D document.getElementById("MVF" + msgid);
   if (!status) return;  // should never happen...  =20
   status.innerHTML =3D "<b style=3D'color:green'>Voting...</b>";
  =20
   var strAction =3D =
"/script/comments/vote.asp?js=3D1&user=3D"+userid+"&msg=3D"+msgid+"&score=
=3D"+score;
   req.open("GET", strAction, true);
   req.send(null);
   return false;
}

</SCRIPT>

            <SCRIPT language=3DJavaScript>
var Selected =3D "";

var AdTime =3D new Date();


// Ensures the expanded message appears reasonably close to where=20
// it should appear: on screen, and if possible, under the mouse cursor.
function SwitchMessage(e)
{
   if ( !e ) e =3D window.event;
   var target =3D e.target ? e.target : e.srcElement;

   // is it a post?
   while ( target && target.id !=3D 'DynMessLink' )
      target =3D target.parentNode;
   if ( !target || target.id !=3D 'DynMessLink' )
      return;

   if (Selected)
   {
      var body =3D document.getElementById(Selected + "_h1");
      if (body)
         body.style.display =3D 'none';
      var head =3D document.getElementById(Selected + "_h0");
      if (head)
         head.bgColor =3D '#FEF9E7';
   }

   if (Selected =3D=3D target.name) // just collapse
      Selected=3D"";
   else
   {
      Selected =3D target.name;
      var body =3D document.getElementById(Selected + "_h1");
      if (body)
      {
         if (body.style.display=3D=3D'none')
            body.style.display=3D'';
         else
            body.style.display =3D 'none';
      }
      var head =3D document.getElementById(Selected + "_h0");
      if (head)
         head.bgColor =3D '#99CCFF';

      if ( body && head && body.style.display !=3D 'none' )
      {
         // the bit that keeps the post on-screen and under the cursor
         //var dif =3D (getRealPos(head, "Top") + head.offsetHeight/2) - =
(document.body.scrollTop+e.clientY);
         //document.body.scrollTop +=3D dif;
         document.body.scrollTop =3D getRealPos(head, "Top") - =
document.body.clientHeight/10;
         EnsureMessageVisible(target.name, true);
      }
   }

   if ( e.preventDefault )
      e.preventDefault();
   else
      e.returnValue =3D false;
   return false;
}

// does its best to make a message visible on-screen (vs. scrolled off =
somewhere).
function EnsureMessageVisible(msgID, bShowTop) {
   var msgHeader =3D document.getElementById(msgID + "_h0");
   var msgBody =3D document.getElementById(msgID + "_h1");

   // determine scroll position of top and bottom
   var scrollContainer =3D document.body;
   var top =3D getRealPos(msgHeader, 'Top');
   var bottom =3D getRealPos(msgBody, 'Top') + msgBody.offsetHeight;

   // if not already visible, scroll to make it so
   if ( scrollContainer.scrollTop > top && !bShowTop)
      scrollContainer.scrollTop =3D top - document.body.clientHeight/10;
   if ( scrollContainer.scrollTop+scrollContainer.clientHeight < bottom =
)
      scrollContainer.scrollTop =3D bottom-scrollContainer.clientHeight;
   if ( scrollContainer.scrollTop > top && bShowTop)
      scrollContainer.scrollTop =3D top - document.body.clientHeight/10;
}

// utility
function getRealPos(i,which)
{
   iPos =3D 0
   while (i!=3Dnull)
   {
      iPos +=3D i["offset" + which];
      i =3D i.offsetParent;
   }
   return iPos
}


</SCRIPT>

            <DIV id=3D_MessageBoard onclick=3DSwitchMessage(event)>
            <TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%" =
bgColor=3D#ff9900=20
            border=3D0>
              <TBODY>
              <TR>
                <TD width=3D"100%">
                  <TABLE id=3DForumTable cellSpacing=3D1 cellPadding=3D0 =
width=3D"100%"=20
                  bgColor=3D#ff9900 border=3D0>
                    <FORM=20
                    =

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -