DEVBUZZ Homepage Sockets project with eVB and VB6.
 
Web www.devbuzz.com
  HOME PAGE
  All Articles
  Advertise
  Consulting

 Development
  Discuss - Forums
  Still in the box?
  .Compact Framework
  Code Snippets
  SQL Server CE
  Database
  MS Resources
 Stores
  Developer Controls
  Pocket PC Hardware
  Pocket PC Software
  Pocket PC Books
  .NET CF Books
  Book Reviews
  SPB SW Discounts
  RESCO SW Discounts
 DEVBUZZ Info
  About Us
  Help
  Join our email list
  Links & Ratings
  Press & Comments
  Pocket PC version
  Software Reviews
  Hardware Reviews
 Authors
  Authors
  Article Guide
  Competitions
 Resources
  Developers
  Register
  Login

  SPB Discounts!
 Columnists
  Rick Winscot
 Past Blast
  Personal Media Ctr
  Gizmobility
  eVB Legacy
  Old news
  Hosted Software
  Wireless
  Newsletters
  Carl Davis
  Upton Au

 Pocket PC Registry
  Join the registry
  View current list
 Current Poll
Are you converting to .NET Compact Framework?
Yes, it has changed my life!
No, I'm sticking with eVB
.NET CF what's that`?

Current results
3431 votes so far
 Recent Forum Threads [goto forums]

Get Computername
read... (67 hits)


Great aid to development productivity
read... (82 hits)


ThreadingTimer sample code
read... (143 hits)


Multithreading with .NET CF
read... (194 hits)


Moving from eMbedded Visual Basic to Visual Basic .NET
read... (166 hits)


.NET Compact Framework 2.0 Service Pack 2
read... (226 hits)


Transfer Data from SQL Server 2000 to SQL Server Compact Edition
read... (298 hits)


This protocol version is not supported
read... (236 hits)


Converting Lowercase to uppercase wont work
read... (203 hits)


Direct access to MS SQL Server 2000
read... (374 hits)


Creating SDF file in Desktop
read... (513 hits)


Winsock in CF.NET
read... (316 hits)


Using Pocket Outlook to submit HTML page form with MAILTO action
read... (420 hits)


Missing file "System.Data.PocketPC.asmmeta.dll"
read... (268 hits)


HP iPAQ hw6915 Serial Port Issue
read... (309 hits)


Info on the recent forum changes
read... (341 hits)


SqlServer tools from Redgate
read... (383 hits)


Arrow keys and Hardware navigation button
read... (393 hits)


O2 XDA lls pin sync cable to comport
read... (322 hits)


Creating dynamic folders on Pocket PC OS
read... (299 hits)

Custom Windows Mobile software development.
LBS Challenge 2007
LBS Challenge Eight previous NAVTEQ Global LBS Challenge® participants have received venture capital funding and nine past LBS Challenge winners have launched commercial applications on major wireless carriers. Register your non-commercial LBS application in the 2007 NAVTEQ Global LBS Challenge in one of three regions: Americas, Europe-Middle East-Africa (EMEA) or Asia-Pacific(APAC). You could win a share of $2 million in prizes. This could be your year.
Dream. Develop. Win.

Development | Starting Out

Sockets project with eVB and VB6.
Written by Pete Vickers  [author's bio]  [read 82750 times]
Edited by Derek

Download the code   Discuss this article   eVB Ver 3.0   

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 

Back to Starting Out | [Article Index]

 

Back to the top of the page.
Chris De Herrera's Windows CE Website Windows CE News & Information Source
Copyright ©2000-2007 by DEVBUZZ.COM, Inc., NJ. USA.MSDEVELOP