웹프로그래밍

Global It Leader!!


컴퓨터언어


 
 

VB Sockets project with eVB and VB6

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 9,425회 작성일 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 오피스팁에서 이동 됨]

댓글목록

등록된 댓글이 없습니다.

전체 441
게시물 검색
컴퓨터언어 목록
번호 제목 글쓴이 조회 날짜
221 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7119 06-25
220 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7937 06-25
219 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8475 06-25
218 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 13431 06-24
217 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8964 06-24
216 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9646 06-17
215 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 25524 07-22
214 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10312 07-21
213 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8791 07-21
212 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9142 07-21
211 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8558 07-20
210 VB no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10447 07-15
209 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8541 07-14
208 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7834 07-14
207 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9399 07-13
열람중 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9426 07-13
205 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8008 07-08
204 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7655 07-08
203 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9044 07-08
202 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8535 07-08