Send Message from One PC to Another

    i want to send a message from one PC to another PC
i am using VB 6.0 and Sql-server 7.0 in my project.
Using any api is it possible?
(and those api will work on Windows NT and windows98 both)
waiting for reply.

Who is Participating?
PBuckConnect With a Mentor Commented:
I have included some code to help you out since you are trying this from scratch (I made our Port Listener as a ActiveX DLL - but will work fine otherwise).

Option Explicit
'----------------------------------------------------------'----------------------------------------------------------Private WithEvents TCPSocketWrite As SocketWrenchCtrl.Socket
Private WithEvents TCPSocketListen As SocketWrenchCtrl.Socket
'Import all the SocketWrench constants!

Public Sub InitWriteSocket()
On Error GoTo errWrite
   Set TCPSocketWrite = New SocketWrenchCtrl.Socket
   If TCPSocketWrite.Connected Then
      TCPSocketWrite.Shutdown = 1      'Close current Connections
   End If
   TCPSocketWrite.AddressFamily = AF_INET
   TCPSocketWrite.Binary = True
   TCPSocketWrite.Blocking = False
   TCPSocketWrite.BufferSize = 2024
   TCPSocketWrite.Timeout = 5000
   TCPSocketWrite.Protocol = mvarProtocol
   If mvarProtocol <> IPPROTO_UDP Then
      TCPSocketWrite.SocketType = SOCK_STREAM   'TCP/IP
      TCPSocketWrite.SocketType = SOCK_DGRAM    'UDP
   End If
   TCPSocketWrite.RemotePort = 0
   Exit Sub
   RaiseEvent Errors(Err.Description)
End Sub

Public Sub InitListenSocket()
On Error GoTo errListen
   Set TCPSocketListen = New SocketWrenchCtrl.Socket
   If TCPSocketListen.Connected Then
      TCPSocketListen.Shutdown = 1     'Close current Connections
   End If
   mvarMAC = TCPSocketListen.PhysicalAddress
   TCPSocketListen.AddressFamily = AF_INET
   TCPSocketListen.Binary = True
   TCPSocketListen.Blocking = False
   If mvarProtocol <> IPPROTO_UDP Then
      TCPSocketListen.Timeout = 5000
      TCPSocketListen.HostAddress = INADDR_ANY
      TCPSocketListen.Protocol = mvarProtocol
      TCPSocketListen.SocketType = SOCK_STREAM  'TCP/IP
      TCPSocketListen.LocalService = "echo"
      TCPSocketListen.AutoResolve = False
      TCPSocketListen.Protocol = mvarProtocol
      TCPSocketListen.SocketType = SOCK_DGRAM   'UDP
   End If
   Exit Sub
   RaiseEvent Errors(Err.Description)
End Sub

Public Sub ListenOnPort(PortNo As Long)
On Error GoTo errPort
   If PortNo > 0 Then
      mvarHostPortNo = PortNo
      If mvarProtocol <> IPPROTO_UDP Then
         TCPSocketListen.LocalPort = PortNo
         TCPSocketListen.LocalPort = PortNo
         TCPSocketListen.RemotePort = PortNo
         mvarListenConnected = True
      End If
   End If
   Exit Sub
   RaiseEvent Errors(Err.Description)
End Sub

'This is just part of the DLL - it is not a large program at all, but I thought the above might help some  :-)
I don't think it is possible for Win98. It would be possible for Win NT or 2000 system. Below will work on NT and 2000.

Try this

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

sorry i pressed the Refresh Button, so my comment added twice
What about using DDE, you would need a client app on one PC and a server app on another? It would work on Win9x. Or what about using TCP\IP?
what kind of messages?  just to a user you could use netsend.  it pops up a window in the middle of their screen.  the syntax is something like net send cpuname or username "message" you could use shell in vb to send the message
Here at my work, we have taken time to redo our main app that everyone uses within the Division and so we added a few features - one is what we called our Port Listener.

Of course, this only works if the listening program is up and running.  But try downloading free control called SocketWrench.  This control makes it extremely easy to build this port listener (we use TCP - but we also have the switch ready to use UDP).

But it is one option on Win9x machines.  Works great!

Hope this helps some!
use the Microsoft Winsock Control that comes with VB6 and create a TCP/IP connection. it's quite simple and supported on ALL versions of windows. (except 3.x - that one has to have a custom built tcp/ip interpreter)
NishaSanganiAuthor Commented:
hello again,

i am trying to work on PBuck suggession.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.