Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
Go Back  Xtreme Visual Basic Talk > > > Newbie to TCP/IP, text transfer


Reply
 
Thread Tools Display Modes
  #1  
Old 05-31-2006, 08:18 AM
Arlanthir Arlanthir is offline
Freshman
 
Join Date: Apr 2006
Posts: 28
Default Newbie to TCP/IP, text transfer


Hi again

I'm trying to develop a simple text transfer program, to send and receive text, a little like mirc, or messenger, but far more simple. I've been searching for tcp/ip tutorials, but found very little besides a reference to UnoLibs...

What should I do? Anyone with knowledge of UnoLibs already?
Any pointers would be nice.

Thanks in advance


(For those interested, it will ultimately be a custom online roleplaying program, with my own game in mind, but perhaps a D&D Add On... Deppending how it turns out :P)
Reply With Quote
  #2  
Old 05-31-2006, 02:39 PM
SharkBait's Avatar
SharkBait SharkBait is offline
Contributor
 
Join Date: Dec 2004
Location: BC, Canada
Posts: 494
Default

I know there is a good .NET example package with samples for Basic networking. Think its the 101 .NET Sample Code or something on the MSDN site.

Their networking sample has a simple client/server text chat. I do have a basic thing of source code kicking around for a simple IRC client in .NET if your interested....

I am somewhat working on a small project that, if I ever get more time to play with it, would be a MUD server and uses would connect via Telnet. But thats far from being able to have users chat.. for now it just allows them to connect and do basic commands..
__________________
SharkBait
Living on the WestCoast of Canada
My journey to blogging success: www.tyleringram.com
Reply With Quote
  #3  
Old 06-01-2006, 09:54 AM
Arlanthir Arlanthir is offline
Freshman
 
Join Date: Apr 2006
Posts: 28
Default

Nice =) I'll search for it then

Good luck on your project!
Reply With Quote
  #4  
Old 06-01-2006, 03:18 PM
SharkBait's Avatar
SharkBait SharkBait is offline
Contributor
 
Join Date: Dec 2004
Location: BC, Canada
Posts: 494
Default

http://msdn.microsoft.com/vstudio/do...s/default.aspx

Seems to be where it is... If you haven't found it yet
__________________
SharkBait
Living on the WestCoast of Canada
My journey to blogging success: www.tyleringram.com
Reply With Quote
  #5  
Old 06-01-2006, 08:09 PM
nihk nihk is offline
Newcomer
 
Join Date: Nov 2005
Location: Tacloban, Philippines
Posts: 11
Default

yo guys, i downloaded the samples.
which one is about communicating through tcp/udp?

and arlanthir im interested with those kind of things too

im currenty creating an orpg not a massively multiplayer one

just a simple one. you can contact me in yahoo messenger
or msn messenger if you're interested in merging
__________________
Note: the text above is purely from my imagination. i HAVEN'T tested it.
Reply With Quote
  #6  
Old 06-02-2006, 08:47 AM
SharkBait's Avatar
SharkBait SharkBait is offline
Contributor
 
Join Date: Dec 2004
Location: BC, Canada
Posts: 494
Default

Though this one might be it too:
http://www.microsoft.com/downloads/d...displaylang=en

One of them has samples with networking in sockets. They use the TCP protocol for client/server.
__________________
SharkBait
Living on the WestCoast of Canada
My journey to blogging success: www.tyleringram.com
Reply With Quote
  #7  
Old 06-02-2006, 05:16 PM
nihk nihk is offline
Newcomer
 
Join Date: Nov 2005
Location: Tacloban, Philippines
Posts: 11
Default

ok thanks, im done with tcp and i proved 1 thing:
it's slow.

i already made a yahoo messenger clone using tcp.
it performed very well on lan, but when i tested it
over the internet. it's really slow.

10 seconds until the other side can read it

i already made my way in learning udp.

i've been reading their descriptions, quickinfos and
anything that the vb2005 ide provides.

i got a lot of errors, but now i know how to use
udp. i'm making a game. i have another problem though
but not now.

good luck to all of us!
__________________
Note: the text above is purely from my imagination. i HAVEN'T tested it.
Reply With Quote
  #8  
Old 06-02-2006, 06:25 PM
SharkBait's Avatar
SharkBait SharkBait is offline
Contributor
 
Join Date: Dec 2004
Location: BC, Canada
Posts: 494
Default

I havent done much with TCP over the net. But yea it can be slower because it checks to make sure each packet arrives successfuly. UDP just sends them all and doesnt care what happens to them.
__________________
SharkBait
Living on the WestCoast of Canada
My journey to blogging success: www.tyleringram.com
Reply With Quote
  #9  
Old 06-02-2006, 06:56 PM
nihk nihk is offline
Newcomer
 
Join Date: Nov 2005
Location: Tacloban, Philippines
Posts: 11
Default

right. im making an online game. a flash based online game
inside a vb.net wrapper application.

my problem is im using a router modem so the ip address
that is visible is the modem's. i tried sending through it
but it seems that the modem blocks it out and the application
never sees the packets
__________________
Note: the text above is purely from my imagination. i HAVEN'T tested it.
Reply With Quote
  #10  
Old 06-06-2006, 08:39 AM
Arlanthir Arlanthir is offline
Freshman
 
Join Date: Apr 2006
Posts: 28
Default

Well, downloading the 101 examples... Any pointers on the right one? =X
Heck, I bet these will be dalmatians to me >< (ahah, I made a joke.)
Reply With Quote
  #11  
Old 06-06-2006, 09:59 AM
Arlanthir Arlanthir is offline
Freshman
 
Join Date: Apr 2006
Posts: 28
Default

Ok, opening the samples gives me a convertor wizards yada yada, I convert them all, get a bunch of errors in obsolete functions and then after I try to build I get a 'reference not found' warning... Is this normal? I'm trying to build everything and then test them...

EDIT: Wrong build order Forgot the dll build eheh

Hmm.. Client gives a large amount of errors.. Anyone?

Last edited by Arlanthir; 06-06-2006 at 10:09 AM.
Reply With Quote
  #12  
Old 06-06-2006, 11:30 AM
Arlanthir Arlanthir is offline
Freshman
 
Join Date: Apr 2006
Posts: 28
Default

*argh!* I downloaded a new (updated, maybe) version, which opens nicely now... Except I can't compile anything due to:

Error 1 Class 'CLSID_CorSymWriter' could not be created: Class not registered
Error 2 Unable to write to output file 'C:\Documents and Settings\Arlanthir\Desktop\RemoteCustomer\obj\Release\RemoteCustomer.p db': Class not registered


God, not even tutorials work? What am I supposed to do now!?
Please Help...
Reply With Quote
  #13  
Old 06-06-2006, 06:25 PM
nihk nihk is offline
Newcomer
 
Join Date: Nov 2005
Location: Tacloban, Philippines
Posts: 11
Default

I don't know which errors you are talking about.

Is it from the 101 Dalmatians?
Try sending us a copy I'm interested in that too.
I'm just too lazy to find those examples.

And what's your username in msn i'll add you.

I'm going to write this game in VB.NET(2005) because
of the built-in features that I would have to write if
I use C++.
I know that Native C-based languages are faster than
Managed Code. But the issue is not the speed of the
the game but the speed of the connection.
__________________
Note: the text above is purely from my imagination. i HAVEN'T tested it.
Reply With Quote
  #14  
Old 06-07-2006, 03:44 PM
Arlanthir Arlanthir is offline
Freshman
 
Join Date: Apr 2006
Posts: 28
Default

Search in MSDN for 'tcp vb.net sample' and you'll get to that.. I don't know the url now.. Well, if you want to add: arlanthir@ilumination(dot)com
Reply With Quote
  #15  
Old 06-16-2006, 02:29 PM
Arlanthir Arlanthir is offline
Freshman
 
Join Date: Apr 2006
Posts: 28
Default

This is the one that doesn't compile.. Should I try Visual Studio (Retail)?
Everything doesn't work.... Can someone help with a simple source that works, tested?
Attached Files
File Type: zip TCPRemoting.zip (115.8 KB, 12 views)
Reply With Quote
  #16  
Old 06-19-2006, 11:00 AM
SharkBait's Avatar
SharkBait SharkBait is offline
Contributor
 
Join Date: Dec 2004
Location: BC, Canada
Posts: 494
Default

Quote:
Originally Posted by Arlanthir
This is the one that doesn't compile.. Should I try Visual Studio (Retail)?
Everything doesn't work.... Can someone help with a simple source that works, tested?
This is 1 sample I used. It shows basic usage of TCP with a Client and Server (both using commandline type setup)

I took the server side code and slowly converting it into work like a Telnet server to run as a MUD type game.

But it should show you the basics of having a client talk to a server via TCP.
Attached Files
File Type: zip 20020323.zip (20.2 KB, 34 views)
__________________
SharkBait
Living on the WestCoast of Canada
My journey to blogging success: www.tyleringram.com
Reply With Quote
  #17  
Old 06-19-2006, 11:17 AM
Arlanthir Arlanthir is offline
Freshman
 
Join Date: Apr 2006
Posts: 28
Default

Ehr.. The server is not printing anything but 'Waiting for connection', and the Client prints the test message, 'Connection accepted' and 'Host returned: ???*happy face*???*heart*' and a bunch of lines...
Wouldn't it be easier if I added you so we could talk this out? This is really bugging me =//

Thank you very much for all! Now I actually feel it's possible xD

Last edited by Arlanthir; 06-19-2006 at 12:18 PM.
Reply With Quote
  #18  
Old 06-19-2006, 03:05 PM
SharkBait's Avatar
SharkBait SharkBait is offline
Contributor
 
Join Date: Dec 2004
Location: BC, Canada
Posts: 494
Default

Oh no... i just looked over the code.. I forgot I modified the original one that won't work for client/server.

The TCPClient.vb creates a test string and connects to a remote computer on the address 192.168.123.79 port 2000

I am going to try and straighten this out and find the original because it was a good basic TCP Client/Server project.

I do apologise for confusing you even more..... I feel bad.
__________________
SharkBait
Living on the WestCoast of Canada
My journey to blogging success: www.tyleringram.com
Reply With Quote
  #19  
Old 06-19-2006, 03:10 PM
Arlanthir Arlanthir is offline
Freshman
 
Join Date: Apr 2006
Posts: 28
Default

No no no, you should feel great! You're |_| this close to god
You've made see I can build something that actually connects to another.. It seems just like a small thing I doubt I can help, because I can't understand anything of the protocol itself.. Either way, if you want anything I can help with.. Just say the word =)
Reply With Quote
  #20  
Old 06-19-2006, 03:53 PM
SharkBait's Avatar
SharkBait SharkBait is offline
Contributor
 
Join Date: Dec 2004
Location: BC, Canada
Posts: 494
Default

I might of found it...

Link: http://www.eggheadcafe.com/articles/20020323.asp

Client Code:
Code:
Imports System.Net.Sockets Imports System.Text Class TCPClient Shared Sub Main() Dim tcpClient As New System.Net.Sockets.TcpClient() tcpClient.Connect("127.0.0.1", 8000) Dim networkStream As NetworkStream = tcpClient.GetStream() If networkStream.CanWrite And networkStream.CanRead Then ' Do a simple write. Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is anybody there") networkStream.Write(sendBytes, 0, sendBytes.Length) ' Read the NetworkStream into a byte buffer. Dim bytes(tcpClient.ReceiveBufferSize) As Byte networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize)) ' Output the data received from the host to the console. Dim returndata As String = Encoding.ASCII.GetString(bytes) Console.WriteLine(("Host returned: " + returndata)) Else If Not networkStream.CanRead Then Console.WriteLine("cannot not write data to this stream") tcpClient.Close() Else If Not networkStream.CanWrite Then Console.WriteLine("cannot read data from this stream") tcpClient.Close() End If End If End If ' pause so user can view the console output Console.ReadLine() End Sub End Class

Server Code:

Code:
Imports System.Net.Sockets Imports System.Text Class TCPServer Shared Sub Main() ' Must listen on correct port- must be same as port client wants to connect on. Const portNumber As Integer = 8000 Dim tcpListener As New TcpListener(portNumber) tcpListener.Start() Console.WriteLine("Waiting for connection...") Try 'Accept the pending client connection and return 'a TcpClient initialized for communication. Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient() Console.WriteLine("Connection accepted.") ' Get the stream Dim networkStream As NetworkStream = tcpClient.GetStream() ' Read the stream into a byte array Dim bytes(tcpClient.ReceiveBufferSize) As Byte networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize)) ' Return the data received from the client to the console. Dim clientdata As String = Encoding.ASCII.GetString(bytes) Console.WriteLine(("Client sent: " + clientdata)) Dim responseString As String = "Connected to server." Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(responseString) networkStream.Write(sendBytes, 0, sendBytes.Length) Console.WriteLine(("Message Sent /> : " + responseString)) 'Any communication with the remote client using the TcpClient can go here. 'Close TcpListener and TcpClient. tcpClient.Close() tcpListener.Stop() Console.WriteLine("exit") Console.ReadLine() Catch e As Exception Console.WriteLine(e.ToString()) Console.ReadLine() End Try End Sub End Class

I happen to find it on eggheadcafe here it the link to the source code:
http://www.eggheadcafe.com/articles/20020323.zip

Its fairly basic. You start the server and it sits there and listens for another connection.

The client connects and sends text to the server. The server sees the incoming and send back a reply to the client.

__________________
SharkBait
Living on the WestCoast of Canada
My journey to blogging success: www.tyleringram.com
Reply With Quote
Reply


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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
 
Newbie to TCP/IP, text transfer
Newbie to TCP/IP, text transfer
 
-->