Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » Client Server in VB.net


Client Server in VB.net

Reply
  #1 (permalink)  
Old 12-26-08, 05:48 PM
jac2703's Avatar
jac2703 jac2703 is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
Hazard Client Server in VB.net

Hi All,

I am fairly new to VB.NET however, not new to programming in general. I have used VB.NET to create many simple programs which interact with SQL so I know the basics. There are however two things that are baffling me and Google isnt helping a great deal.

- Client\ server communication using sockets. I have tried a few examples but I cant seem to figure them out properly. I want a simple application which receives a few lines from a central point and actions them accordingly. The overall idea is a notepad in the system tray of many computers which holds snippets of SQL code. It could perhaps refresh every x hours so that the latest code snippets are always available and have user snippets related to each client machine which the user can save (but lets just get the basics first!).

- This brings me on to my next point. Multi threading. Now I have the basics here covered and have made a few applications which use a separate thread to perform data read/writes. I cannot however, use them in the above scenario. I think the problem relates to me not understanding the above, and once I do i am sure it will fall into place.

What I am asking is quite a lot, and feel free to send PMs of abuse. Or ask me for any Oracle PL/SQL help in return (I know its a neche).

Could someone write a simple piece of code which uses sockets, with a new thread for each connection with lots and lots of rem[']s? Or point me to any tutorials which work in VB.NET. As I said, I have Googled and not found that many simple or detailed enough or which actually work when finished.

Your time is greatly appreciated.

J
__________________
JamesCoyle.net Blog and Network tools.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 12-26-08, 09:03 PM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,167
Thanks: 3
Thanked 8 Times in 8 Posts
Hello Jack,

A good example of simple socket communication is shown in the following article:

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

What I am not sure about though is the need for your application to be Multi-threaded or even to use socket communication if all you need to do is to check for new SQL snipplets from a central server once every hour. I wouldn't use socket communication for something like this at all and would instead write a Web Service using ASP.NET, and reference it from the regular Windows Form Application. All you would then have to do is to put a timer on the form and make a call to Webservice at X time interval.

Detecting dropped socket connections caused by either network hiccups or outages is not an easy task to do. What would happen is either your client, or your server (or both) hang for long intervals of time waiting for response from the other side which never arrives. There are ways to overcome this type of dropped socket issue (none that are easy), but in a way by going down that route you would be over complicating your project.


Pete
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 12-28-08, 10:42 AM
jac2703's Avatar
jac2703 jac2703 is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

Thanks for the response. The reason I am using sockets in this application is mainly to get an understanding of how it works because as you say, it is a bit over-kill for what I need.

Once I can use them I will be able to implement their functionality into more complex programming.

I did find a good link which got me up and running (It is about an hour long but is so simple even an idiot could follow it; me {oh, I would recommend right click on the media player link and save as}):

http://www.bestechvideos.com/2008/07...-vb-net-part-1

This example seems to use the thread pool (I think 25 threads) and so would not be great for 100s of connections. I will post a link, when I find one, to show how true multi threading and sockets work.

Regards

J
__________________
JamesCoyle.net Blog and Network tools.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] 500 Internal Server Error - Please help Dawn Perl 15 07-08-08 12:08 PM
Sockets: Java client, python server problem UnrealEd Everything Java 0 12-17-06 04:49 PM
soccet client server gagarin_uri C/C++ 1 11-15-06 05:09 PM
Need Instant Messenger Server + Client HopesDespair Job Offers & Assistance 3 06-24-05 11:42 AM
Please Help ! sweetgurl Everything Java 2 04-13-04 12:57 PM


All times are GMT -5. The time now is 08:26 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.