Computing.Net > Forums > Programming > VB Chat program

VB Chat program

Reply to Message Icon

Original Message
Name: AlwaysWillingToLearn
Date: June 26, 2007 at 01:19:55 Pacific
Subject: VB Chat program
OS: winxp pro sp2
CPU/Ram: P4 3.2
Model/Manufacturer: MSI
Comment:

Hi,

i am wrighting a chat program in Visual Basic 6.0 using Winsock. I have three computers at home one belonging to me another my sister and brother. what i want to do it basically make a program which will allow all of us to talk to eachother while we are on the computers, we are all on the same network.

Here is what i have so far
my program works so far but the problem is i have to keep on telling my bro and sis my IP add so that they can type it into the program for it to connect to me, i have done some reaserach and found something called computer friendly name. isnt there anyway i can substitue the IP add for this name and ask my program to connect using this?

so for example

Winsock1.RemotePort =123
Winsock1.Listen
Winsock1.Connect "127.0.0.1"

Can i not use

Winsock1.Connect "Thecomputer" ??

it doesnt throw an error when i do this and it doesnt work either so im not sure what is going wrong

any help would be much appreciated.

Thanks,


Report Offensive Message For Removal


Response Number 1
Name: Razor2.3
Date: June 27, 2007 at 00:51:01 Pacific
Subject: VB Chat program
Reply: (edit)

I'm not sure if WinXP's DNS API supports NetBIOS names, but you can try it:

'DNS Lookup
Declare Function DnsQuery Lib "dnsapi.dll" Alias "DnsQuery_A" _
(ByVal sName As String, _
ByVal iType As DnsType, _
ByVal lOptions As Long, _
ByVal iExtra As Integer, _
ByRef QueryResultsSet As Long, _
ByVal lReserved As Integer) As Long

'DNS Cleanup
Declare Sub FreeDnsList Lib "dnsapi.dll" Alias "DnsRecordListFree" _
(ByVal RecordList As Long, _
ByVal FreeType As Long)

The second one you'll need to run once you have your IP. The first one returns (via QueryResultsSet) a pointer to:

Type DnsRecord
pNext As Long
sName As String
iType As Integer
iDataLength As Integer
lFlags As Long
lTTL As Long
lReserved As Long
lData As Long
End Type

DnsType is a 60 line long Enum, so I'm not going to list it here. Just do a Google search for Windns.h, and that should at least give you the commonly enumerated values.



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: VB Chat program

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge