|How to Port MS to .NET
|Page 1 of 1|
|Author:||William [ Sat Oct 19, 2019 6:52 pm ]|
|Post subject:||How to Port MS to .NET|
This is a starter guide but it will take you very far, it should help you convert your ms server completely. You should always start by converting the server. So do not bother converting the client and server at the same time. You can start converting the ms vb6 client when you can connect with that client to your finished ms server in .NET.
How to Port to VB .net or .net Core.
1. Download Visual Studio 2008.
2. Open your VB project with it and chose convert and run the wizard (begin with the server, its easiest).
3. Run your new vb.net server, and fix all the common errors that appeared.
4. Remove your frmServer and create a new form called ServerWindow (move some data if needed from frmServer).
5. Download https://www.codeproject.com/Articles/11422/Winsock-NET (this one had a bug in it, so when I first tested this I had to modify a row in the source code. So would recommend you include the project so you can debug it easier. This is if you actually want winsock. I used it initially for a smooth port and later changed to TcpClient: https://docs.microsoft.com/en-us/dotnet ... mework-4.8)
6. Implement winsock net to your project.
7. If you have byte arrays you will have more difficulties, I had to rewrite all of modBuffer etc.
8. Make sure things work, connect the client.
Things that confused me at first
Here is the winsock part, pretty short and simple. All you do is add:
Public Shared Network As New Sockethandler
in the ServerWindow class. And add:
in the ServerWindow form loaded sub.
And then you will have some errors with frmServer.Socket that you change to ServerWindow.Server...
Public Class Sockethandler
Public WithEvents Server As Winsock
Public Sockets As New Dictionary(Of Integer, Winsock)
Private m_SocketsToRemove As New List(Of Winsock)
Public Sub Initialize()
Server = New Winsock
Server.LocalPort = 4000
Server.RemotePort = 4000
Server.RemoteIP = "127.0.0.1"
Public Function GetState(index As Integer) As WinsockStates
If TryGetUser(index) Is Nothing Then
Public Function TryGetIndex(socket As Winsock) As Integer
For Each item As KeyValuePair(Of Integer, Winsock) In Sockets
If item.Value Is socket Then
Public Function TryGetUser(index As Integer) As Winsock
If Sockets.ContainsKey(index) Then Return Sockets(index)
Private Sub Socket_ConnectionRequest(sender As Winsock, requestID As Socket) Handles Server.ConnectionRequest
Dim i As Integer
i = FindOpenPlayerSlot()
Dim ws As Winsock = CType(sender, Winsock)
AddHandler ws.DataArrival, AddressOf wsk_DataArrival
AddHandler ws.Disconnected, AddressOf wsk_Disconnected
Call AcceptConnection(ws, requestID, i)
Catch ex As Exception
Private Sub wsk_Disconnected(sender As Winsock)
If m_SocketsToRemove.Contains(sender) Then Exit Sub
If m_SocketsToRemove.Count > 0 Then
Catch ex As Exception
Private Sub wsk_DataArrival(sender As Winsock, BytesTotal As Integer)
If IsConnected(TryGetIndex(sender)) Then
Call IncomingData(TryGetIndex(sender), BytesTotal)
I'm using SFML for the graphics and most likely the audio ( https://www.sfml-dev.org/ ).
SFML provides a simple interface to the various components of your PC, to ease the development of games and multimedia applications. It is composed of five modules: system, window, graphics, audio and network.
With SFML, your application can compile and run out of the box on the most common operating systems: Windows, Linux, macOS and soon Android & iOS.
1. Download and install: http://go.microsoft.com/fwlink/?linkid=321343
1.1 Make sure it works on computer without powerpacks installed. Those files should be included in EXE.
2. Needed to put Interop.DxVBLib.dll into my: C:\Windows\SysWOW64 folder!
3. Temporarily added ms symbols (should be able to ignore this): http://www.vbforums.com/showthread.php? ... e-PDB-file
4. Net framework 4 on project.
5. Used this for smooth form transitions: http://vbcity.com/forums/t/158363.aspx (put in my basepage).
|Author:||LoriLambert [ Fri Oct 09, 2020 10:30 am ]|
|Post subject:||Re: How to Port MS to .NET|
Slots online bingo free no deposit casino is the best and safest way to make money. I suggest you try it!
|Page 1 of 1||All times are UTC|
|Powered by phpBB® Forum Software © phpBB Group