Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 9th, 2007, 9:26 PM   #11
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: well i need some help on winsock stuff

This thread is over a year old. If the OP hasn't solved his/her problem, you're probably way to late. Please refer to the date of the post, right above the user name.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 6th, 2008, 2:52 PM   #12
~The~ICE~Man~
Programmer
 
Join Date: Feb 2008
Location: Canada
Posts: 13
Rep Power: 0 ~The~ICE~Man~ is on a distinguished road
Send a message via MSN to ~The~ICE~Man~ Send a message via Yahoo to ~The~ICE~Man~
Re: well i need some help on winsock stuff

Quote:
Originally Posted by RAzR Creations View Post
i am making a program that i want to connect to 2 computers over the internet using remotehostip what i did was on the form load event i did label1.caption = serversock.remotehostip but nothing shows up but i also want the program to auto detect it just like mine is 65.80.200.47 i want it to auto detect it and put it in the label caption can anyone help?
Even though your query is old I will put this up incase 1 you still need help with it or 2 If another person wants to set up a LAN Chat System. Note you need 2 sides or 2 small progyz, 1 is the server and the other is the client, Client has to be on any PC that the server wants to chat with. Complete source code for both is below. This will only work on/over or through a LAN system and will not work over the Internet

LAN Chat System
server side is as follows

Private Sub cmdSend_Click()
On Error GoTo NoConnection
Winsock1.SendData "Severer : " + txtSend
NoConnection:
Exit Sub
End Sub

Private Sub Form_Load()
Winsock1.LocalPort = 80
Winsock1.Listen
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim GetMessage As String
Winsock1.GetData GetMessage
txtChat = txtChat + GetMessage + vbCrLf
End Sub



Client side is as follows

Private Sub cmdSend_Click()
Winsock1.SendData "Client : " & txtSend
txtMain = txtMain & "Client : " & txtSend & vbNewLine & vbCrLf
End Sub

Private Sub newcon_Click()
Dim NewIP As String
NewIP = InputBox("Please put in the IP of your buddy or PC on the network to connect to")
Winsock1.Close
Winsock1.Connect NewIP, 80
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim GetMessage As String
Winsock1.GetData GetMessage
txtMain = txtMain & GetMessage & vbNewLine & vbCrLf
End Sub
~The~ICE~Man~ is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:40 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC