Send Message from One PC to Another

hello,
     
    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.

thankx
nisha
NishaSanganiAsked:
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
     
'WRITER
   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
   Else
      TCPSocketWrite.SocketType = SOCK_DGRAM    'UDP
   End If
   TCPSocketWrite.RemotePort = 0
   Exit Sub
   
errWrite:
   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
     
'LISTENER
   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"
   Else
      TCPSocketListen.AutoResolve = False
      TCPSocketListen.Protocol = mvarProtocol
      TCPSocketListen.SocketType = SOCK_DGRAM   'UDP
   End If
   Exit Sub
   
errListen:
   RaiseEvent Errors(Err.Description)
End Sub

Public Sub ListenOnPort(PortNo As Long)
On Error GoTo errPort
   If PortNo > 0 Then
      mvarHostPortNo = PortNo
      InitListenSocket
      If mvarProtocol <> IPPROTO_UDP Then
         TCPSocketListen.LocalPort = PortNo
         TCPSocketListen.Listen
      Else
         TCPSocketListen.LocalPort = PortNo
         TCPSocketListen.RemotePort = PortNo
         TCPSocketListen.Open
         mvarListenConnected = True
      End If
   End If
   Exit Sub
   
errPort:
   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  :-)
0
 
hongjunCommented:
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
http://www.freevbcode.com/ShowCode.Asp?ID=395

hongjun
0
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.

 
sridhar_PJCommented:
sorry i pressed the Refresh Button, so my comment added twice
Sridhar
0
 
rhubarbtwoCommented:
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?
0
 
jrspanoCommented:
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
0
 
PBuckCommented:
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 www.catalyst.com 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!
0
 
dredgeCommented:
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)
0
 
wsh2Commented:
<ping>
0
 
NishaSanganiAuthor Commented:
hello again,

i am trying to work on PBuck suggession.
thankx
0
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.