Global It Leader!!



 
 

VB Sockets project with eVB and VB6

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 8,961회 작성일 10-07-13 15:49

본문

Page 1  Page 2  Page 3 

Following up on my last adventure into the dark world of 'sockets' programming, I decided there must be a better way than the winsock control. GUI3000, my commercial software uses the sockets API, and this was really the way I wanted to go in eVB, but lack of support for UDT's, and the fact that the copymemory API is much used in VB sockets persuaded me against this. I thought there was a light at the end of the tunnel, when I read in the help file, that the Winsock control returned a socket handle for use in further calls. Alas, the light was only a train heading towards me, as I could not get this to work.

So once again, dusting off and donning the thinking cap I set to work. I decided to delve into the twilight zone of eVC, and write a wrapper for the sockets API callable from eVB. This article is the result of my labours, and contains the eVB and VB code to write a 'mickey-mouse' client server application WITHOUT the use of Winsock.ocx, or a safety net.

The project consists of a client process, written in eVB, and a server process, written in VB6. The server process simply accepts a connection from the client, accepts data, and sends it back. Both projects and the dll(s) are available for download.

First we need to declare the dll calls used by the program. I have tried to use the same names as the sockets API calls, prefixed by Ce.

Option Explicit
Declare Function CeWSAStartup _
Lib "CeSockets.dll" _
(vreq As Integer, ByVal debug_mode As Integer) _
As Integer
Declare Function CeSocket _
Lib "CeSockets.dll" _
() As Integer
Declare Function CeConnect _
Lib "CeSockets.dll" _
(ByVal isocket As Integer, _
ByVal iport As Integer, _
ByVal Shost As String) As Integer
Declare Function Cesend Lib "CeSockets.dll" _
(ByVal isocket As Integer, _
ByVal sbuff As String, _
ByVal ilen As Integer, _
ByVal iflags As Integer) _
As Integer
Declare Function Cerecv Lib "CeSockets.dll" _
(ByVal isocket As Integer, _
ByVal rbuff As String, _
ByVal ilen As Integer, _
ByVal iflags As Integer) _
As Integer
Declare Function CeGetIpAddress Lib _
"CeSockets.dll" (ByVal shostname As String, _
ByVal shostip As String) As Integer
Declare Function Cegethostbyaddr _
Lib "CeSockets.dll" _
(ByVal shostip As String, _
ByVal shostname As String) As Integer
Declare Function Cegetpeername Lib _
"CeSockets.dll" (ByVal isock As Integer, _
ByVal Shost As String) As Integer
Declare Function Cegethostname Lib _
"CeSockets.dll" (ByVal Shost As String) _
As Integer
Declare Function Ceclosesocket Lib _
"CeSockets.dll" (ByVal isocket As Integer) _
As Integer
Declare Function CeWSACleanup Lib _
"CeSockets.dll" () As Integer
Private hostname As String
Private hostip As String
Private iret As Integer
Private isocket As Integer
Private iport As Integer
Private sbuff As String
Private rbuff As String
Private ivreq As Integer

We then need to design a form, to allow us to connect, send and recv data.

Next Page 

[이 게시물은 오원장님에 의해 2013-02-28 16:42:18 오피스팁에서 이동 됨]

댓글목록

등록된 댓글이 없습니다.

전체 95
게시물 검색
컴퓨터언어 목록
번호 제목 글쓴이 조회 날짜
35 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10036 07-15
34 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8108 07-14
33 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7420 07-14
32 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8896 07-13
열람중 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8962 07-13
30 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7567 07-08
29 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7250 07-08
28 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8597 07-08
27 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8089 07-08
26 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7887 07-08
25 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8248 07-08
24 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9305 07-05
23 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8799 07-04
22 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8872 07-02
21 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8090 07-01
20 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4865 10-29
19 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5319 08-31
18 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10432 08-31
17 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5278 08-31
16 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6574 08-31