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

📄 227.htm

📁 unix高级编程原吗
💻 HTM
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>CTerm非常精华下载</title>
</head>
<body bgcolor="#FFFFFF">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="577">
<tr><td width="32%" rowspan="3" height="123"><img src="DDl_back.jpg" width="300" height="129" alt="DDl_back.jpg"></td><td width="30%" background="DDl_back2.jpg" height="35"><p align="center"><a href="http://apue.dhs.org"><font face="黑体"><big><big>apue</big></big></font></a></td></tr>
<tr>
<td width="68%" background="DDl_back2.jpg" height="44"><big><big><font face="黑体"><p align="center">               ● UNIX网络编程                       (BM: clown)                </font></big></big></td></tr>
<tr>
<td width="68%" height="44" bgcolor="#000000"><font face="黑体"><big><big><p   align="center"></big></big><a href="http://cterm.163.net"><img src="banner.gif" width="400" height="60" alt="banner.gif"border="0"></a></font></td>
</tr>
<tr><td width="100%" colspan="2" height="100" align="center" valign="top"><br><p align="center">[<a href="index.htm">回到开始</a>][<a href="188.htm">上一层</a>][<a href="228.htm">下一篇</a>]
<hr><p align="left"><small>发信人: hey (吟风·魂之利刃), 信区: Socket <br>

标  题: POP3编程(2) <br>

发信站: 华南网木棉站 (Thu May 28 14:04:32 1998), 转信 <br>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] <br>

POP3编程(2) <br>

Subject: POP3编程(2) <br>

From: javabean.bbs@bbs.nju.edu.cn (咖啡豆) <br>

Date: 05 May 1998 15:55:36 GMT <br>

Newsgroups: cn.bbs.comp.winsock <br>

Organization: nju_bbs <br>

Xref: ustcnews cn.bbs.comp.winsock:503 <br>

// SG_POP3PrimarySocket.cpp : implementation file <br>

#include "stdafx.h" <br>

#include "SG_POP3PrimarySocket.h" <br>

#include "SG_POP3SecondarySocket.h" <br>

#include "..\\SGConfigAPI.h" <br>

#ifdef _DEBUG <br>

#define new DEBUG_NEW <br>

#undef THIS_FILE <br>

static char THIS_FILE[] = __FILE__; <br>

#endif <br>

#define POP3_PORT 110 <br>

//////////////////////////////////////////////////////////////////////////// <br>



/ <br>

CSG_POP3PrimarySocket::CSG_POP3PrimarySocket() <br>

{ <br>

        m_bClosed=FALSE; <br>

        m_bClosed=FALSE; <br>

CSG_POP3PrimarySocket::~CSG_POP3PrimarySocket() <br>

{ <br>

        //Close(); <br>

        //m_connectionList <br>

// Do not edit the following lines, which are needed by ClassWizard. <br>

#if 0 <br>

BEGIN_MESSAGE_MAP(CSG_POP3PrimarySocket, CSocket) <br>

        //{{AFX_MSG_MAP(CSG_POP3PrimarySocket) <br>

        //}}AFX_MSG_MAP <br>

END_MESSAGE_MAP() <br>

#endif  // 0 <br>

//////////////////////////////////////////////////////////////////////////// <br>

/ <br>

// CSG_POP3PrimarySocket member functions <br>

BOOL CSG_POP3PrimarySocket::StartUp() <br>

{ <br>

        return TRUE; <br>



} <br>

void CSG_POP3PrimarySocket::OnAccept(int nErrorCode) <br>

{ <br>

        // TODO: Add your specialized code here and/or call the base class <br>

        CSG_POP3SecondarySocket* pSocket = new CSG_POP3SecondarySocket(this) <br>

; <br>

        TRY <br>

        { <br>

                if(Accept(*pSocket)) <br>

                { <br>

                        pSocket->Init(); <br>

                        m_connectionList.AddTail(pSocket); <br>

                } <br>

                else <br>

                        delete pSocket; <br>

        } <br>

        CATCH(CException,e) <br>

        { <br>

                e->Delete(); <br>

                SGSystemLog("Pop3 Server Error-------->OnAccept()\r\n"); <br>

                if(pSocket) <br>

                        delete pSocket; <br>



                int errNum=GetLastError(); <br>

                if(errNum==WSAEMFILE) <br>

                { <br>

                        SGSystemLog("Pop3 Server Accept Que is Empty!!\n"); <br>

                } <br>

        } <br>

        END_CATCH <br>

} <br>

void CSG_POP3PrimarySocket::CloseSocket() <br>

{ <br>

        if(m_bClosed) <br>

                return; <br>

        m_bClosed=TRUE; <br>

        ShutDown(both); <br>

        Close(); <br>

        CSG_POP3SecondarySocket *pSocket; <br>

        for (POSITION pos=m_connectionList.GetHeadPosition(); pos!=NULL;) <br>

        { <br>

                pSocket = (CSG_POP3SecondarySocket *)m_connectionList.GetNex <br>

t(ps <br>

); <br>

                pSocket->ShutDown(both); <br>



                pSocket->Close(); <br>

                delete pSocket; <br>

        } <br>

        m_connectionList.RemoveAll(); <br>

} <br>

void CSG_POP3PrimarySocket::RemoveAt(CSG_POP3SecondarySocket * pClient) <br>

{ <br>

        POSITION posNext,posCur; <br>

        if(pClient==NULL) <br>

                return; <br>

        for(posNext=m_connectionList.GetHeadPosition();posNext!=NULL;) <br>

        { <br>

                posCur=posNext; <br>

                CSG_POP3SecondarySocket *pSocket=(CSG_POP3SecondarySocket*)m <br>

_con <br>

ectionList.GetNext(posNext); <br>

                if(pClient==pSocket) <br>

void CSG_POP3PrimarySocket::RemoveAt(CSG_POP3SecondarySocket * pClient) <br>

{ <br>

        POSITION posNext,posCur; <br>

        if(pClient==NULL) <br>

                return; <br>



        for(posNext=m_connectionList.GetHeadPosition();posNext!=NULL;) <br>

        { <br>

                posCur=posNext; <br>

                CSG_POP3SecondarySocket *pSocket=(CSG_POP3SecondarySocket*)m <br>

_con <br>

ectionList.GetNext(posNext); <br>

                {f(pClient==pSocket) <br>

                        m_connectionList.RemoveAt(posCur); <br>

                        break; <br>

                } <br>

        } <br>

        delete pClient; <br>

} <br>

-- <br>

[46m [30m  --- JavaBean---   [40m <br>

[m[1;37m※ 来源:.南大小百合信息交换站 bbs.nju.edu.cn.[FROM: ns.ace.nju.edu <br>

.][m <br>

Prev by Date: POP3 编程1(转贴) <br>

Next by Date: POP3 编程(3) <br>

Prev by thread: POP3 编程1(转贴) <br>

Next by thread: POP3 编程(3) <br>

Index(es): <br>



Date <br>

Thread <br>

-- <br>

        ┌──────────────────────────────┐ <br>

        │     I believe I can fly, I believe I can touch the sky.    │ <br>

        └──────────────────────────────┘ <br>

</small><hr>
<p align="center">[<a href="index.htm">回到开始</a>][<a href="188.htm">上一层</a>][<a href="228.htm">下一篇</a>]
<p align="center"><a href="http://cterm.163.net">欢迎访问Cterm主页</a></p>
</table>
</body>
</html>

⌨️ 快捷键说明

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