打算回武汉了,看看那有没好点的工作

31737951 2009-08-13 06:35:31
7 年 pb

会点c++ pb搞不定的 用他来写动态库 (主要这用途)

数据库主要用sqlserver,设计用powerdesigner

其他的语言 java ,net ,delphi 都会点 这些主要做些周边的产品,不算精通

发觉深圳呆的很不习惯,没热干面吃 嘿嘿,好久没见过雪 怪想滴

兄弟门 说说武汉滴 pb咋样?

pb现在是不行了 大都是小公司用,换其他的语言把 舍不的,想想 用pb很快就搞定了 还费那劲干吗 呵呵 惰性

看看武汉有大点的公司用pb的没?福利如何 调查调查


...全文
324 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
龙剑行 2009-08-17
  • 打赏
  • 举报
回复
对于武汉,那是我的家。我工作算来也十年了,外地工作了近八年,工作己经稳定下来。经常在心里对自己说“好想回武汉!”,钱真的是赚不完的,可是家只有一个,要是回武汉我还能做什么呢?想改行自己创业,有这种想法的武汉的兄弟们,大家交个朋友,为我们回武汉谋个出路吧,
31737951 2009-08-15
  • 打赏
  • 举报
回复
无聊
青锋-SS 2009-08-14
  • 打赏
  • 举报
回复
gx
31737951 2009-08-14
  • 打赏
  • 举报
回复
主要想回去,对深圳的灯红酒绿 高节奏厌烦了 还是比较喜欢 大热天晚上 光膀子 座马路边 边吃火锅边吹牛
呵呵
tiantanglyz 2009-08-14
  • 打赏
  • 举报
回复
不会阿,我感觉深圳这边的天气比武汉的天气要好,武汉太热了。深圳这边晚上很凉快的
31737951 2009-08-14
  • 打赏
  • 举报
回复
沿海是这样 空气湿度大 感觉闷
myclife 2009-08-14
  • 打赏
  • 举报
回复
上周去深圳,又热又闷,赶上修地铁,路况很差。

出租车挑活,难道不怕投诉么?
永生天地 2009-08-14
  • 打赏
  • 举报
回复
楼主的代码好长,一眼望不到头,先收下,说不定以后用的上
31737951 2009-08-14
  • 打赏
  • 举报
回复
我现在烦透了 一年四季就夏天了,还有广东这边水污染太严重,环境不好,不想呆啊
tiantanglyz 2009-08-14
  • 打赏
  • 举报
回复
呵呵,我上个月才从武汉过来,那边有个搞自来水收费系统的公司不知道你有没有兴趣,我在那里做了一个月,不太适应武汉的天气所以没有做了。
www8523 2009-08-14
  • 打赏
  • 举报
回复
pb人才呀!到哪都能找到好工作的!!!
singsongs 2009-08-14
  • 打赏
  • 举报
回复
支持楼主,帮顶了!
newease 2009-08-14
  • 打赏
  • 举报
回复
只要是你喜欢的地方,哪里都一样
31737951 2009-08-13
  • 打赏
  • 举报
回复

public function integer of_connect (string ip, integer prot);int i
char sin_zero[8]
str_sockaddr addr

for i = 1 to 8
sin_zero[i] = char(0)
next

addr.sin_family = 2
addr.sin_port = htons(prot)
addr.sin_addr = inet_addr( ip )
addr.sin_zero = sin_zero

i = sconnect( ii_socknum, addr, 16)
if i <> 0 then
of_error(WSAGetLastError())
return i
end if

of_event(1025, FD_WRITE+FD_READ +FD_OOB +fd_close )

is_ip = ip
ii_prot = prot

return i

end function

public function integer of_send (string data);blob buf
int i
buf = blob(data)
i = send(ii_socknum,buf,len(buf),0)

if i < 0 then
of_error(WSAGetLastError())
end if

return i
end function

on uo_socket_client_win32.create
end on

on uo_socket_client_win32.destroy
end on

event destructor;of_close( )
WSACleanup()
end event

event constructor;integer i
// This is necessary to prevent GPFs
wsInfo.szdescription = space(257)
wsInfo.szsystemstatus = space(129)
wsInfo.lpvendorinfo = space(256) //if vendorinfo > 256 then OOPS
wsInfo.wversion = 0
wsInfo.whighversion = 0
wsInfo.imaxsockets = 0
wsInfo.imaxudgdg = 0

i = WSAStartup(257,wsInfo) // 257 is binary high byte = 1 low byte = 1
// for a short unsigned integer
// (WORD typedef in WINDOWS.H)
if i <> 0 then
i = WSAStartup(257,wsInfo)
if i <> 0 then
ii_error = WSAStartup(257,wsInfo)
end if
end if

if i <> 0 then
messagebox("Error","WSAStartup() failed! Winsock not ready!",stopsign!)
end if

ii_socknum = socket(2,1,0) //1-tcp,2-udp
if ii_socknum = 65535 then
ii_socknum = 0
messagebox('','创建服务失败')
return
end if

end event

31737951 2009-08-13
  • 打赏
  • 举报
回复
//客户端
forward
global type uo_socket_client_win32 from userobject
end type
end forward

global type uo_socket_client_win32 from userobject
integer width = 160
integer height = 120
long backcolor = 67108864
string text = "none"
long tabtextcolor = 33554432
long picturemaskcolor = 536870912
event ue_read pbm_custom02
event ue_timer pbm_timer
end type
global uo_socket_client_win32 uo_socket_client_win32

type prototypes
FUNCTION ulong inet_addr( ref string cp) LIBRARY "wsock32.dll"
FUNCTION string inet_ntoa( ulong addr)LIBRARY "wsock32.dll"

Function uint accept (uint s,ref str_sockaddr addr, ref int addrlen) Library "wsock32.dll"
Function integer bind (uint s, str_sockaddr name, int namelen) Library "wsock32.dll"
Function integer closesocket (uint s) Library "wsock32.dll"
Function integer getsockname (uint s,ref str_sockaddr name, ref int namelen) Library "wsock32.dll"
Function integer getsockopt (uint s, int level, int optname,str_linger optval, int optlen) Library "wsock32.dll"
Function integer htons (int hostshort) Library "wsock32.dll"
Function integer ntohs (int netshort) Library "wsock32.dll"
Function integer listen (uint s, int backlog) Library "wsock32.dll"
Function integer shutdown (uint s, int how) Library "wsock32.dll"
Function integer send (int s, ref blob buf, int len, int flags) Library "wsock32.dll"
Function integer setsockopt (uint s, int level, int optname,str_linger optval, int optlen) Library "wsock32.dll"
Function uint socket (int af, int ttype, int protocol) Library "wsock32.dll"
Function integer recv (int s, ref blob buf, int len, int flags) Library "wsock32.dll"
Function integer sconnect (uint s, str_sockaddr name, int namelen) Library "wsock32.dll" alias for "connect"
Function integer WSACleanup () Library "wsock32.dll"
Function integer WSAAsyncSelect (uint s, uint Wnd, uint wMsg, long lEvent) Library "wsock32.dll"
Function integer WSACancelBlockingCall () Library "wsock32.dll"
Function integer WSAGetLastError () Library "wsock32.dll"
Function integer WSAStartup (uint wVersionRequested, ref wsadata lpWSAData) Library "wsock32.dll"



end prototypes

type variables
unsignedinteger ii_socknum = 0 //连接地址

string is_ip = '' //连接ip
uint ii_prot = 0 //连接断口

int ii_Error //错误码
int ii_status = 0

wsadata wsInfo

// Define flags to be used with wsaasyncselect()
int FD_READ = 1
int FD_WRITE = 2
int FD_OOB = 4
int FD_ACCEPT = 8
int FD_CONNECT = 16
int FD_CLOSE = 32


boolean ib_link = false
end variables

forward prototypes
public function string of_inet_ntoa (unsignedlong add)
public function long of_parsetoarray (string as_source, string as_delimiter, ref string as_array[])
public function integer of_close ()
public function integer of_event (unsignedinteger wmsg, long levent)
public function string of_error (integer id)
public function integer of_connect (string ip, integer prot)
public function integer of_send (string data)
end prototypes

event ue_read;Blob buf
int iRet

ii_status = IntLow (lparam)
iRet = IntHigh(lParam)

if iRet <> 0 then
return
end if

choose case ii_status
case FD_READ
ib_link = true
buf = Blob(Space(2046))
iRet = Recv(ii_socknum,buf, Len(buf), 0)
if iRet <> -1 then
parent.dynamic event ue_read(this.ii_socknum ,this.is_ip , this.ii_prot, string (BlobMid(buf , 1,iRet) ))
end if
case FD_WRITE
ib_link = true
case FD_CLOSE
ib_link = false
of_close()
case FD_OOB
ib_link = true
case else
end choose
end event

public function string of_inet_ntoa (unsignedlong add);integer iTmp
string sIPAddr

sIPAddr = space(16) // Dotted quad IP address XXX.XXX.XXX.XXX + 1

sIPAddr = inet_ntoa( add)

return sIPAddr

end function

public function long of_parsetoarray (string as_source, string as_delimiter, ref string as_array[]);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_ParseToArray
//
// Access: public
//
// Arguments:
// as_Source The string to parse.
// as_Delimiter The delimeter string.
// as_Array[] The array to be filled with the parsed strings, passed by reference.
//
// Returns: long
// The number of elements in the array.
// If as_Source or as_Delimeter is NULL, function returns NULL.
//
// Description: Parse a string into array elements using a delimeter string.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.02 Fixed problem when delimiter is last character of string.

// Ref array and return code gave incorrect results.
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright ?1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

long ll_DelLen, ll_Pos, ll_Count, ll_Start, ll_Length
string ls_holder

//Check for NULL
IF IsNull(as_source) or IsNull(as_delimiter) Then
long ll_null
SetNull(ll_null)
Return ll_null
End If

//Check for at leat one entry
If Trim (as_source) = '' Then
Return 0
End If

//Get the length of the delimeter
ll_DelLen = Len(as_Delimiter)

ll_Pos = Pos(Upper(as_source), Upper(as_Delimiter))

//Only one entry was found
if ll_Pos = 0 then
as_Array[1] = as_source
return 1
end if

//More than one entry was found - loop to get all of them
ll_Count = 0
ll_Start = 1
Do While ll_Pos > 0

//Set current entry
ll_Length = ll_Pos - ll_Start
ls_holder = Mid (as_source, ll_start, ll_length)

// Update array and counter
ll_Count ++
as_Array[ll_Count] = ls_holder

//Set the new starting position
ll_Start = ll_Pos + ll_DelLen

ll_Pos = Pos(Upper(as_source), Upper(as_Delimiter), ll_Start)
Loop

//Set last entry
ls_holder = Mid (as_source, ll_start, Len (as_source))

// Update array and counter if necessary
if Len (ls_holder) > 0 then
ll_count++
as_Array[ll_Count] = ls_holder
end if

//Return the number of entries found
Return ll_Count

end function

public function integer of_close ();if closesocket(ii_socknum) = 0 then
ii_socknum = 0
else
return 0
end if

ib_link = false

return 1

end function

public function integer of_event (unsignedinteger wmsg, long levent);int i
i = WSAAsyncSelect (ii_socknum, Handle(this) , wMsg,lEvent)

if i <> 0 then
of_error(WSAGetLastError())

end if

return i
end function

public function string of_error (integer id);string ls

choose case id
case 10004
ls = 'WSAEINTR:通过一个WSACancelBlockingCall()来取消一个(阻塞的)调用'
case 10009
ls = 'WSAEBADF:Bad file number'
case 10013
ls = 'WSAEACCES:Permission denied'
case 10014
ls = 'WSAEFAULT:namelen参数不正确'
case 10022
ls = 'WSAEINVAL:套接口没有准备好与一地址捆绑'
case 10024
ls = 'WSAEMFILE:无多余文件描述字'
case 10035
ls = 'WSAEWOULDBLOCK:Operation would block'
case 10036
ls = 'WSAEINPRO:当应用程序调用 Windows Sockets API函数时,如果 一个阻塞函数正在 运行,将返回该错误。'
case 10037
ls = 'WSAEALREADY:被废除的异步调用已经完成.'
case 10038
ls = 'WSAENOTSOCK:描述字不是一个套接口'
case 10039
ls = 'WSAEDESTADDRREQ:需要一个目的地址'
case 10040
ls = 'WSAEMSGSIZE:套接口为SOCK_DGRAM类型,且数据报大于WINDOWS套接口实现所支持的最大值'
case 10041
ls = 'WSAEPROTOTYPE:指定的协议不适用于本套接口'
of_close()
case 10042
ls = 'WSAENOPROTOOPT:未知或不支持选项。其中,SOCK_STREAM类型的套接口不支持SO_BROADCAST选项,SOCK_DGRAM类型的套接口不支持SO_DONTLINGER 、SO_KEEPALIVE、SO_LINGER和SO_OOBINLINE选项'
case 10043
ls = 'WSAEPROTONOSUPPORT:不支持指定的协议'
case 10044
ls = 'WSAESOCKTNOSUPPORT:本地址族中不支持该类型套接口'
case 10045
ls = 'WSAEOPNOTSUPP:已设置了MSG_OOB,但套接口非SOCK_STREAM类型'
case 10046
ls = 'WSAEPFNOSUPPORT:Protocol family not supported'
case 10047
ls = 'WSAEAFNOSUPPORT:所指定地址族中地址无法与本套接口一切使用'
case 10048
ls = 'WSAEADDRINUSE:所指的地址已在使用中'
case 10049
ls = 'WSAEADDRNOTAVAIL:指定的地址在本地机器不能使用'
of_close()
case 10050
ls = 'WSAENETDOWN:WINDOWS套接口实现检测到网络子系统失效'
of_close()
case 10051
ls = 'WSAENETUNREACH:当前无法从本主机联上网络'
of_close()
case 10052
ls = 'WSAENETRESET:由于WINDOWS套接口实现放弃了连接,故该连接必需被复位'
of_close()
case 10053
ls = 'WSAECONNABORTED:由于超时或其他原因,虚电路失效'
case 10054
ls = 'WSAECONNRESET:连接由远端重建'
case 10055
ls = 'WSAENOBUFS:无可用缓冲区。套接口未被连接'
of_close()
case 10063
ls = 'WSAENAMETOOLONG:File name too long'
case 10062
ls = 'WSAELOOP:Too many levels of symbolic links'
case 10061
ls = 'WSAECONNREFUSED:连接的尝试被拒绝'
of_close()
case 10060
ls = 'WSAETIMEDOUT:试图连接超时,未建立连接'
of_close()
case 10059
ls = 'WSAETOOMANYREFS:Too many references, can"t splice'
case 10058
ls = 'WSAESHUTDOWN:套接口已被关闭。当一个套接口以0或2的how参数调用shutdown()关闭后,无法再用recv()接收数据'
of_close()
case 10057
ls = 'WSAENOTCONN: 套接口没有连接'
of_close()
case 10056
ls = 'WSAEISCONN:套接口早已连接'
case 10064
ls = 'WSAEHOSTDOWN:Host is down'
case 10065
ls = 'WSAEHOSTUNREACH:No Route to Host'
case 10091
ls = 'WSASYSNOTREAD:由WSAStartup() 函数返回,表明 底层的网络子系统 无法使用'
of_close()
case 10092
ls = 'WSAVERNOTSUPP:由WSAStartup() 函数返回,表明 Windows Sockets DLL不支持这一 应用'
case 10093
ls = 'WSANOTINITIAL:由除了WSAStartup() 的其他函数返回,表明 没有对WSAStartup()函数 的成功调用'
case 11001
ls = 'WSAHOST_NOT_F:未找到授权应答主机'
of_close()
case 11001
ls = 'WSATRY_AGAIN:未找到非授权应答主机,或SERVERFAIL'
of_close()
case 11003
ls = 'WSANO_RECOVER: 无法恢复的错误,FORMERR,REFUSED,NOTIMP'
case 11004
ls = 'WSANO_DATA:有效的名字,但没有关于请求类型的数据记录 '
case else
ls = '不明错误'
end choose


return ls

end function
31737951 2009-08-13
  • 打赏
  • 举报
回复

public function integer of_bind (unsignedinteger asocket, string aip, integer prot);
int i
char sin_zero[8]
str_sockaddr addr


for i = 1 to 8
sin_zero[i] = char(0)
next

addr.sin_family = 2
addr.sin_port = htons(prot)
addr.sin_addr = inet_addr( aip )

i = bind( asocket, addr, 16)

if i <> 0 then
of_error(asocket, WSAGetLastError())
return i
end if

return i
end function

public function integer of_close (unsignedinteger asocket);if asocket > 0 and asocket < 655535 then
closesocket(asocket)
end if

int i
i = ids_socket_list.find("socket =" + string(asocket) , 1, ids_socket_list.rowcount())
if i > 0 then
ids_socket_list.deleterow(i)
end if

return 1

end function

public function string of_error (unsignedinteger socket, integer id);string ls

choose case id
case 10004
ls = 'WSAEINTR:通过一个WSACancelBlockingCall()来取消一个(阻塞的)调用'
case 10009
ls = 'WSAEBADF:Bad file number'
case 10013
ls = 'WSAEACCES:Permission denied'
case 10014
ls = 'WSAEFAULT:namelen参数不正确'
case 10022
ls = 'WSAEINVAL:套接口没有准备好与一地址捆绑'
case 10024
ls = 'WSAEMFILE:无多余文件描述字'
case 10035
ls = 'WSAEWOULDBLOCK:Operation would block'
case 10036
ls = 'WSAEINPRO:当应用程序调用 Windows Sockets API函数时,如果 一个阻塞函数正在 运行,将返回该错误。'
case 10037
ls = 'WSAEALREADY:被废除的异步调用已经完成.'
case 10038
ls = 'WSAENOTSOCK:描述字不是一个套接口'
case 10039
ls = 'WSAEDESTADDRREQ:需要一个目的地址'
case 10040
ls = 'WSAEMSGSIZE:套接口为SOCK_DGRAM类型,且数据报大于WINDOWS套接口实现所支持的最大值'
case 10041
ls = 'WSAEPROTOTYPE:指定的协议不适用于本套接口'
of_close(socket)
case 10042
ls = 'WSAENOPROTOOPT:未知或不支持选项。其中,SOCK_STREAM类型的套接口不支持SO_BROADCAST选项,SOCK_DGRAM类型的套接口不支持SO_DONTLINGER 、SO_KEEPALIVE、SO_LINGER和SO_OOBINLINE选项'
case 10043
ls = 'WSAEPROTONOSUPPORT:不支持指定的协议'
case 10044
ls = 'WSAESOCKTNOSUPPORT:本地址族中不支持该类型套接口'
case 10045
ls = 'WSAEOPNOTSUPP:已设置了MSG_OOB,但套接口非SOCK_STREAM类型'
case 10046
ls = 'WSAEPFNOSUPPORT:Protocol family not supported'
case 10047
ls = 'WSAEAFNOSUPPORT:所指定地址族中地址无法与本套接口一切使用'
case 10048
ls = 'WSAEADDRINUSE:所指的地址已在使用中'
case 10049
ls = 'WSAEADDRNOTAVAIL:指定的地址在本地机器不能使用'
of_close(socket)
case 10050
ls = 'WSAENETDOWN:WINDOWS套接口实现检测到网络子系统失效'
of_close(socket)
case 10051
ls = 'WSAENETUNREACH:当前无法从本主机联上网络'
of_close(socket)
case 10052
ls = 'WSAENETRESET:由于WINDOWS套接口实现放弃了连接,故该连接必需被复位'
of_close(socket)
case 10053
ls = 'WSAECONNABORTED:由于超时或其他原因,虚电路失效'
case 10054
ls = 'WSAECONNRESET:连接由远端重建'
case 10055
ls = 'WSAENOBUFS:无可用缓冲区。套接口未被连接'
of_close(socket)
case 10063
ls = 'WSAENAMETOOLONG:File name too long'
case 10062
ls = 'WSAELOOP:Too many levels of symbolic links'
case 10061
ls = 'WSAECONNREFUSED:连接的尝试被拒绝'
of_close(socket)
case 10060
ls = 'WSAETIMEDOUT:试图连接超时,未建立连接'
of_close(socket)
case 10059
ls = 'WSAETOOMANYREFS:Too many references, can"t splice'
case 10058
ls = 'WSAESHUTDOWN:套接口已被关闭。当一个套接口以0或2的how参数调用shutdown()关闭后,无法再用recv()接收数据'
of_close(socket)
case 10057
ls = 'WSAENOTCONN: 套接口没有连接'
of_close(socket)
case 10056
ls = 'WSAEISCONN:套接口早已连接'
case 10064
ls = 'WSAEHOSTDOWN:Host is down'
case 10065
ls = 'WSAEHOSTUNREACH:No Route to Host'
case 10091
ls = 'WSASYSNOTREAD:由WSAStartup() 函数返回,表明 底层的网络子系统 无法使用'
of_close(socket)
case 10092
ls = 'WSAVERNOTSUPP:由WSAStartup() 函数返回,表明 Windows Sockets DLL不支持这一 应用'
case 10093
ls = 'WSANOTINITIAL:由除了WSAStartup() 的其他函数返回,表明 没有对WSAStartup()函数 的成功调用'
case 11001
ls = 'WSAHOST_NOT_F:未找到授权应答主机'
of_close(socket)
case 11001
ls = 'WSATRY_AGAIN:未找到非授权应答主机,或SERVERFAIL'
of_close(socket)
case 11003
ls = 'WSANO_RECOVER: 无法恢复的错误,FORMERR,REFUSED,NOTIMP'
case 11004
ls = 'WSANO_DATA:有效的名字,但没有关于请求类型的数据记录 '
case else
ls = '不明错误'
end choose


return ls

end function

public function integer of_send (unsignedinteger socket, string data);blob buf
int i
buf = blob(data)
i = send(socket,buf,len(buf),0)

if i < 0 then
of_error(socket,WSAGetLastError())
return i
end if

return i
end function

public function integer of_send (string data);int i

for i = 1 to ids_socket_list.rowcount()
if ids_socket_list.object.socket[i] > 0 then
of_send(ids_socket_list.object.socket[i] , data)
end if
next

return 1
end function

on uo_socket_master_win32.create
end on

on uo_socket_master_win32.destroy
end on

event destructor;of_close( )
WSACleanup()
destroy ids_socket_list
end event

event constructor;int i

ids_socket_list = create DataStore
ids_socket_list.dataobject = 'd_socket_list_win32'

// This is necessary to prevent GPFs
wsInfo.szdescription = space(257)
wsInfo.szsystemstatus = space(129)
wsInfo.lpvendorinfo = space(256) //if vendorinfo > 256 then OOPS
wsInfo.wversion = 0
wsInfo.whighversion = 0
wsInfo.imaxsockets = 0
wsInfo.imaxudgdg = 0

i = WSAStartup(257,wsInfo) // 257 is binary high byte = 1 low byte = 1

if i <> 0 then
i = WSAStartup(257,wsInfo)
if i <> 0 then
i = WSAStartup(257,wsInfo)
end if
end if

if i <> 0 then
messagebox("Error","WSAStartup() failed! Winsock not ready!",stopsign!)
end if


end event

lovemoreh 2009-08-13
  • 打赏
  • 举报
回复
好,收藏起来,谢谢!
31737951 2009-08-13
  • 打赏
  • 举报
回复
//winsocket的api 大部分可以使用,有一些pb使用不了的 如 取本机ip的 参数是个可变的 还有组塞模式的我没做,windows下推荐用非组塞模式的
分两个 一个是服务端 一个是 客户端

//服务端
forward
global type uo_socket_master_win32 from userobject
end type
end forward

global type uo_socket_master_win32 from userobject
integer width = 114
integer height = 100
long backcolor = 67108864
string text = "none"
long tabtextcolor = 33554432
long picturemaskcolor = 536870912
event ue_read pbm_custom02
event ue_timer pbm_timer
event ue_accept pbm_custom01
end type
global uo_socket_master_win32 uo_socket_master_win32

type prototypes
FUNCTION ulong inet_addr( ref string cp) LIBRARY "wsock32.dll"
FUNCTION string inet_ntoa( ulong addr)LIBRARY "wsock32.dll"

Function uint accept (uint s,ref str_sockaddr addr, ref int addrlen) Library "wsock32.dll"
Function integer bind (uint s, str_sockaddr name, int namelen) Library "wsock32.dll"
Function integer closesocket (uint s) Library "wsock32.dll"
Function integer getsockname (uint s,ref str_sockaddr name, ref int namelen) Library "wsock32.dll"
Function integer getsockopt (uint s, int level, int optname,str_linger optval, int optlen) Library "wsock32.dll"
Function integer htons (int hostshort) Library "wsock32.dll"
Function integer ntohs (int netshort) Library "wsock32.dll"
Function integer listen (uint s, int backlog) Library "wsock32.dll"
Function integer shutdown (uint s, int how) Library "wsock32.dll"
Function integer send (int s, ref blob buf, int len, int flags) Library "wsock32.dll"
Function integer setsockopt (uint s, int level, int optname,str_linger optval, int optlen) Library "wsock32.dll"
Function uint socket (int af, int ttype, int protocol) Library "wsock32.dll"
Function integer recv (int s, ref blob buf, int len, int flags) Library "wsock32.dll"
Function integer sconnect (uint s, str_sockaddr name, int namelen) Library "wsock32.dll" alias for "connect"
Function integer WSACleanup () Library "wsock32.dll"
Function integer WSAAsyncSelect (uint s, uint Wnd, uint wMsg, long lEvent) Library "wsock32.dll"
Function integer WSACancelBlockingCall () Library "wsock32.dll"
Function integer WSAGetLastError () Library "wsock32.dll"
Function integer WSAStartup (uint wVersionRequested, ref wsadata lpWSAData) Library "wsock32.dll"



end prototypes

type variables
//int ii_Error //错误码

unsignedinteger ii_listen = 0

wsadata wsInfo

// Define flags to be used with wsaasyncselect()
int FD_READ = 1
int FD_WRITE = 2
int FD_OOB = 4
int FD_ACCEPT = 8
int FD_CONNECT = 16
int FD_CLOSE = 32

string is_listen_ip
uint ii_listen_prot
DataStore ids_socket_list

end variables

forward prototypes
public function string of_inet_ntoa (unsignedlong add)
public function long of_parsetoarray (string as_source, string as_delimiter, ref string as_array[])
public function integer of_close ()
public function integer of_event (unsignedinteger ai_socket, unsignedinteger wmsg, long levent)
public function integer of_accept (unsignedinteger asocket)
public function integer of_listen (unsignedinteger asocket)
public function integer of_begin ()
public function integer of_bind (unsignedinteger asocket, string aip, integer prot)
public function integer of_close (unsignedinteger asocket)
public function string of_error (unsignedinteger socket, integer id)
public function integer of_send (unsignedinteger socket, string data)
public function integer of_send (string data)
end prototypes

event ue_read;Blob buf
int iRet , i,li_status
uint li_socknum

li_socknum = wparam

li_status = IntLow (lparam)
iRet = IntHigh(lParam)

if iRet <> 0 then
return
end if

choose case li_status
case FD_READ
buf = Blob(Space(2046))
iRet = Recv(li_socknum,buf, Len(buf), 0)
if iRet <> -1 then
i = ids_socket_list.find("socket ="+string(li_socknum),1,ids_socket_list.rowcount())
if i > 0 then
parent.dynamic event ue_read(li_socknum ,ids_socket_list.object.ip[i] , ids_socket_list.object.port[i], string (BlobMid(buf , 1,iRet) ))
ids_socket_list.object.state[i] = 'READ'
end if
end if
case FD_WRITE
i = ids_socket_list.find("socket ="+string(li_socknum),1,ids_socket_list.rowcount())
if i > 0 then
ids_socket_list.object.state[i] = 'WRITE'
end if
case FD_CLOSE
of_close(li_socknum)
case FD_OOB
case else
end choose
end event

event ue_accept;uint i
ulong ul_ip
int port

//li_status = IntLow(lParam)

of_accept( wparam )
end event

public function string of_inet_ntoa (unsignedlong add);integer iTmp
string sIPAddr

sIPAddr = space(16) // Dotted quad IP address XXX.XXX.XXX.XXX + 1

sIPAddr = inet_ntoa( add)

return sIPAddr

end function

public function long of_parsetoarray (string as_source, string as_delimiter, ref string as_array[]);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_ParseToArray
//
// Access: public
//
// Arguments:
// as_Source The string to parse.
// as_Delimiter The delimeter string.
// as_Array[] The array to be filled with the parsed strings, passed by reference.
//
// Returns: long
// The number of elements in the array.
// If as_Source or as_Delimeter is NULL, function returns NULL.
//
// Description: Parse a string into array elements using a delimeter string.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.02 Fixed problem when delimiter is last character of string.

// Ref array and return code gave incorrect results.
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright ?1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

long ll_DelLen, ll_Pos, ll_Count, ll_Start, ll_Length
string ls_holder

//Check for NULL
IF IsNull(as_source) or IsNull(as_delimiter) Then
long ll_null
SetNull(ll_null)
Return ll_null
End If

//Check for at leat one entry
If Trim (as_source) = '' Then
Return 0
End If

//Get the length of the delimeter
ll_DelLen = Len(as_Delimiter)

ll_Pos = Pos(Upper(as_source), Upper(as_Delimiter))

//Only one entry was found
if ll_Pos = 0 then
as_Array[1] = as_source
return 1
end if

//More than one entry was found - loop to get all of them
ll_Count = 0
ll_Start = 1
Do While ll_Pos > 0

//Set current entry
ll_Length = ll_Pos - ll_Start
ls_holder = Mid (as_source, ll_start, ll_length)

// Update array and counter
ll_Count ++
as_Array[ll_Count] = ls_holder

//Set the new starting position
ll_Start = ll_Pos + ll_DelLen

ll_Pos = Pos(Upper(as_source), Upper(as_Delimiter), ll_Start)
Loop

//Set last entry
ls_holder = Mid (as_source, ll_start, Len (as_source))

// Update array and counter if necessary
if Len (ls_holder) > 0 then
ll_count++
as_Array[ll_Count] = ls_holder
end if

//Return the number of entries found
Return ll_Count

end function

public function integer of_close ();int i

for i = 1 to ids_socket_list.rowcount()
if ids_socket_list.object.socket[i] <> 0 then
closesocket(ids_socket_list.object.socket[i])
ids_socket_list.object.socket[i] = 0
end if
next

ids_socket_list.reset()

if ii_listen > 0 and ii_listen < 65535 then
closesocket(ii_listen)
end if

return 1

end function

public function integer of_event (unsignedinteger ai_socket, unsignedinteger wmsg, long levent);int i
i = WSAAsyncSelect (ai_socket, Handle(this) , wMsg,lEvent)

if i <> 0 then
of_error(ai_socket,WSAGetLastError())

end if

return i
end function

public function integer of_accept (unsignedinteger asocket);ulong ul_new
int i , j
int sockid = 0
string ls_ip
str_sockaddr addr

for i = 1 to 8
addr.sin_zero[i] = char(0)
next

addr.sin_family = 2
addr.sin_port = htons(0)
addr.sin_addr = 0

j = 16

ul_new = accept( asocket,ref addr, j)

if ul_new = 65535 then
return -1
end if

if of_event(ul_new, 1025, FD_READ+FD_WRITE+FD_CLOSE ) <> 0 then
of_close(ul_new)
return -1
end if

ls_ip = of_inet_ntoa ( addr.sin_addr )
i = ids_socket_list.find("socket =" + string(ul_new) + " or ip = '"+ls_ip+"'" , 1, ids_socket_list.rowcount())

if i > 0 then
ids_socket_list.object.ip[i] = ls_ip
ids_socket_list.object.port[i] = ii_listen_prot
ids_socket_list.object.socket[i] = ul_new
return 1
end if

int li_idex = 0
for i = 1 to ids_socket_list.rowcount()
if ids_socket_list.object.socket[i] = 0 then
li_idex = i
exit
end if
next

if li_idex < 1 then
ids_socket_list.insertrow(0)
li_idex = ids_socket_list.rowcount()
end if

ids_socket_list.object.socket[li_idex] = ul_new
ids_socket_list.object.ip[li_idex] = ls_ip
ids_socket_list.object.port[li_idex] = ii_listen_prot

return 0
end function

public function integer of_listen (unsignedinteger asocket);int i

i = listen(asocket , 5)

if i <> 0 then
of_error( asocket, WSAGetLastError())
return i

end if

return i
end function

public function integer of_begin ();ulong ul_ip ,ul_ip1
int i

ul_ip = inet_addr( is_listen_ip)

if ii_listen > 0 and ii_listen < 65535 then
of_close( )
end if

ii_listen = socket(2,1,0) //1-tcp,2-udp

if ii_listen = 65535 then
ii_listen = 0
//'创建服务失败'
return -1
end if

if of_event(ii_listen, 1024, fd_accept ) <> 0 then
return -1
end if

if of_bind(ii_listen, is_listen_ip, ii_listen_prot) <> 0 then
return -1
end if

if of_listen( ii_listen) <> 0 then
return -1
end if

return 1
end function
31737951 2009-08-13
  • 打赏
  • 举报
回复
我写的一个 winsocket的用户对象

结构体
global type timeval from structure
long tv_sec
long tv_usec
end type

global type fd_set from structure
unsignedinteger fd_count
unsignedinteger fd_array[64]
end type

global type wsadata from structure
unsignedinteger wversion
unsignedinteger whighversion
character szdescription[257]
character szsystemstatus[129]
unsignedinteger imaxsockets
unsignedinteger imaxudgdg
string lpvendorinfo
end type

global type str_sockaddr from structure
integer sin_family
unsignedinteger sin_port
ulong sin_addr
character sin_zero[8]
end type

global type str_linger from structure
integer l_onoff
integer l_linger
end type

用到的api
FUNCTION ulong inet_addr( ref string cp) LIBRARY "wsock32.dll"
FUNCTION string inet_ntoa( ulong addr)LIBRARY "wsock32.dll"

Function uint accept (uint s,ref str_sockaddr addr, ref int addrlen) Library "wsock32.dll"
Function integer bind (uint s, str_sockaddr name, int namelen) Library "wsock32.dll"
Function integer closesocket (uint s) Library "wsock32.dll"
Function integer getsockname (uint s,ref str_sockaddr name, ref int namelen) Library "wsock32.dll"
Function integer getsockopt (uint s, int level, int optname,str_linger optval, int optlen) Library "wsock32.dll"
Function integer htons (int hostshort) Library "wsock32.dll"
Function integer ntohs (int netshort) Library "wsock32.dll"
Function integer listen (uint s, int backlog) Library "wsock32.dll"
Function integer shutdown (uint s, int how) Library "wsock32.dll"
Function integer send (int s, ref blob buf, int len, int flags) Library "wsock32.dll"
Function integer setsockopt (uint s, int level, int optname,str_linger optval, int optlen) Library "wsock32.dll"
Function uint socket (int af, int ttype, int protocol) Library "wsock32.dll"
Function integer recv (int s, ref blob buf, int len, int flags) Library "wsock32.dll"
Function integer sconnect (uint s, str_sockaddr name, int namelen) Library "wsock32.dll" alias for "connect"
Function integer WSACleanup () Library "wsock32.dll"
Function integer WSAAsyncSelect (uint s, uint Wnd, uint wMsg, long lEvent) Library "wsock32.dll"
Function integer WSACancelBlockingCall () Library "wsock32.dll"
Function integer WSAGetLastError () Library "wsock32.dll"
Function integer WSAStartup (uint wVersionRequested, ref wsadata lpWSAData) Library "wsock32.dll"


31737951 2009-08-13
  • 打赏
  • 举报
回复
没事发点技术帖 反正无聊
加载更多回复(1)
一. 课程介绍本课程结合Python进行统计与数据分析的原理讲解与实战,涵盖了大部分统计&数据分析模型,特别是当前比较主流的算法:参数估计、假设检验、线性归、广义线性归、Lasso、岭归、广义可加模型、归样条等;机器学习经常用到的主成分分析、因子分析、典型相关分析、聚类分析等;各种非参数统计模型,包括非参数统计推断、尺度推断、位置推断、非参数核密度估计、非参数归等。本课程主要针对有一定Python编程基础、即将毕业参加工作的的大三大四学生,或者已经参加工作需要提升自己数据分析能力以及转行从事IT行业尤其是数据&大数据分析工作的初入职场者,或者正在攻读硕博士学位需要学习和掌握量化研究方法的研究生。本课程对于即将从事机器学习、深度学习&人工智能相关工作的程序员也有很大帮助,有利于打好坚实的理论基础。二. 课程目录第0章 课程导学第1章 数据描述性分析1.1 描述统计量1.2 数据的分布1.3 概率分布函数的图形1.4 直方图、经验分布函数与QQ图1.5 多元数据的数据特征与相关性分析1.6 多元数据的基本图形表示第2章 参数估计2.1 点估计2.2 区间估计第3章 假设检验3.1 基本原理3.2 参数检验第4章 归分析4.1 归分析的概念与一元线性归4.2 多元线性归及统计量解析4.3 逐步归与模型选择4.4 归诊断4.5 广义线性归4.6 非线性归第5章 方差分析5.1 单因素方差分析5.2 双因素方差分析第6章 判别分析与聚类分析6.1 判别分析6.2 聚类分析第7章 主成分分析、因子分析与典型相关分析7.1 主成分分析7.2 因子分析7.3 典型相关分析第8章 非参数统计8.1 经验分布和分布探索8.2 单样本非参数统计推断8.3 两独立样本的位置与尺度判断8.4 多组数据位置推断8.5 分类数据的关联分析8.6 秩相关与分位数归8.7 非参数密度估计8.8 一元非参数归三. 讲师简介主讲人李进华博士,本、硕、博皆就读于武汉大学信息管理学院,2005年获博士学位进入211高校任教,2012年受聘为教授。从事信息管理与数据分析方面的教学、科研与系统开发工作20余年,具备深厚理论修养和丰富实战经验。是中国最早从事Java开发的程序员和Oracle数据库的DBA之一。曾带领团队开发《葛洲坝集团三峡工程指挥中心三期工程施工管理系统》、《湖北省财政厅国有企事业单位资产管理系统》等大型MIS。

397

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 非技术版
社区管理员
  • 非技术版社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧