首 页 编程技术 网页设计 软件频道 系统维护 网络安全 范文大全 站长专区
首 页 编程技术 网页设计 软件频道 系统维护 网络安全 范文大全 站长专区
设为首页
加入收藏
联系我们
首 页 | ASP技术 | PHP技术 | NET技术 | JSP技术 | AJAX | C++ | JavaScript | HTML | | 布局配色 | MSSQL | MySQL | Access
DreamWeaver | FrontPage | Flash | PhotoShop | Firework | CorelDraw | 操作系统 | 办公软件 | 网络营销 | 搜索引擎 | 站长专区 | 服务器 | 范文大全 | 安全
asp.net的vb7中如何使用socket作一个传送时间的server
发布日期:[08-03-20 00:26:41] 点击次数:[]

利用Socket 可以编写一个 向 客户端传送 时间的 一个程序,现在他还只能向
固定的客户端 传送时间,我打算过几天 写一个 可以向 浏览器传送 时间的一个程序
请大家随时注意我的站点的更新情况。。。
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Text

Public Class DateTimeServer
Public Shared Sub temp()
System.Console.WriteLine("hello")
Console.Writeline("Hello\n")
End Sub

Public Shared Sub Main()
Dim now As Date
Dim strDateLine As String
Dim ASCII As Encoding = Encoding.ASCII

Dim tcpl As New TCPListener(13) 'listen on port 13

tcpl.Start()

Console.WriteLine("Waiting for clients to connect")
Console.WriteLine("Press Ctrl+c to Quit...")

While (True)
' Accept will block until someone connects
Dim s As Socket = tcpl.Accept()

' Get the current date and time then concatenate it
' into a string
now = DateTime.Now
strDateLine = now.ToShortDateString() + " " + now.ToLongTimeString()

' Convert the string to a Byte Array and send it
Dim byteDateLine() As Byte = ASCII.GetBytes(strDateLine.ToCharArray())
s.Send(byteDateLine, byteDateLine.Length, 0)
Console.WriteLine("Sent " + strDateLine)
End While
End Sub
End Class


上一篇:
下一篇:

热点文章

· 鼠年知运 2008年编程语言运势抢先
· Windows Server 2008新功能影响应
· 程序员的处世哲学:好酒不怕巷子
· 使用AJAX技术构建更优秀的Web应用
· 你的网站为什么粘不住流量? 
· SCA,软件开发的3G时代
· 浅谈网上教学的实践与探索
· 论IP电话在我国的发展
· 2008年最热门的七大IT软件技能
· 教你四招--轻松让你成为Excel函数
· WIN2000 SERVER安全配置服务器手
· WIN2000 SERVER安全配置服务器手
· Fireworks 8 混合模式详解2
· 浅谈网上教学的实践与探索
· 完整的Windows 2000服务配置

搜索引擎

网站留言 | 友情连接 | 广告服务 | 版权申明 | 合作伙伴 | 法律声明 | 人员招聘 | 网站简介 | 联系我们 | About Us
站内所有资源均收集于互联网,其版权属原作者所有。 E吧-中国IT门户欢迎你的光临!
赣ICP备07501208号