Global It Leader!!



 
 

VB Sockets project with eVB and VB6

페이지 정보

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

댓글목록

등록된 댓글이 없습니다.

전체 440
게시물 검색
컴퓨터언어 목록
번호 제목 글쓴이 조회 날짜
220 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7469 06-25
219 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8034 06-25
218 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 13005 06-24
217 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8539 06-24
216 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9231 06-17
215 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 24954 07-22
214 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9922 07-21
213 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8411 07-21
212 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8725 07-21
211 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8114 07-20
210 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10036 07-15
209 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8110 07-14
208 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7421 07-14
207 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8897 07-13
열람중 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8963 07-13
205 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7568 07-08
204 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7251 07-08
203 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8598 07-08
202 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8090 07-08
201 VB no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7887 07-08