Jul 26, 2008

Receiving Data With Winsock

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > VB Programming

free web hosting

Receiving Data With Winsock

kvarnerexpress
I'm making a game server browser that, when loaded, runs through an array of IP's and sends a query to each of them - each of these IP's returns some data. When I receive this data, I want to parse it and store it in to the array

I'm making a game server browser that holds all the game data in an array which is a custom data structure. The array holds information like IP, number of players, name of server etc.

When the program loads, I want it to loop through the servers array and query all the IP's in there (the IP's are pre-set). The game servers will send back some data, which I want to parse and stick back in to the right array value corresponding to the IP (ie information like game server name, number of players etc).

What would be the best way to do this? At the moment, when the form loads I've got it looping through the array and sending off the query string, but when it returns, how do I find the right array etc? Would I be best off to just make a function that searches the array for the IP that has been returned, find the matching array value and enter the data in there using that? Or is there a better method?

Another problem I have is that the Winsock control will not only be used for handling the return of query data from servers - it may also handle other data such as login information. How would I go about telling the Winsock control what sort of data it should be expecting? What I mean is, if I'm logging in, when data is returned, I want it to validate the user, but if I'm getting server query data back, I want it to parse it or something.
thanks,kvarnerexpress

 

 

 


Reply

Galahad
What protocol are you using? TCP or UDP?

If you are using UDP protocol, it will make things easier for you, but UDP is a connectionless protocol, meaning, there is no permanent connection made between clien and a server.

If you are using TCP protocol, that will be a bit more difficult. You will need an array of Winsock controls, that will be used for each connection with the client.
FOr example, use one Winsock control to listen for incoming connections, and an array of Winsock controls to accept incoming data for each client.

It would look something like this:
CODE

' Create 2 Winsock controls, name one wskListen, and one wskClients
' Set Index property of wskClients to 0

Private Sub wskListen_ConnectionRequest(ByVal requestID As Long)
 If NumConnections = 0 Then
   wskClients(0).Accept requestID
 Else
   Load wskClients(NumConnections)
   wskClients(NumConnections).Accept requestID
 End If
 NumConnections = NumConnections + 1
End Sub



This is just an example, there is a lot of example code on Planet Source Code (PSC)

As for recognition of incoming data, you will need to design your own protocol, and make a parser for that. Maybe something like this:

For login data:
CODE

LOGIN: <username> <password>



For client incoming data
CODE

CLIENT: <data>



This is ofcourse just an idea, off head... If I come up with something better, I'll post it here. Hope I helped.

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : receiving, data, winsock

  1. Need Help With My Database [resolved]
    retrive data as a link (6)
  2. Very Disappointed With Data Center Migration
    What do you think? (9)
    I am hopping mad. I have had nothing but grief since Trap 17 moved their Data Center (DC).
    My site has been down more time than it has been up. I have had to contact Live Support at Xisto 4
    times now in the last month. This is ridiculous. They fix things, it lasts a few days and my site
    is down again. I am at my wits end. I have been told my support to contact Shree. I have
    already communicated with him and he told me that things were solved 6/16, then whatever happened,
    my site was lost completely and had to be restored from their backup. My whole acc....
  3. 1 Terabyte Of Data On A Thumb Drive
    Yes, a whole terabyte! (8)
    Source Seriously, this is innovative. I can't wait for them to produce these...though you know
    the sellers are gonna jack the hell out of the price. In any case, I can only wonder what this will
    mean for desk top and laptop computers. I mean if they can fit a terabyte in a thumb drive with this
    technology, think of how much they can fit into a normal comp. Think of how much music that would
    hold....how many games you could fit.....the possibilities are almost literally endless.....
  4. Eraser - Erase Your Data Permanently! For Free
    A must have software (7)
    When you delete file and empty recycle bin (Windows), it doesn't actually gone permanently!
    Many software can be used to recover those deleted files. Now think and imagine, you've deleted
    your personal file or something then someone recover and steal it. Don't worry, Eraser will come
    in handy What does it do? It delete files permanently! Nothing and noone can recover it. You
    can make previously deleted files not recoverable too by using Erase unused disk space feature. (if
    you want to sell your harddisk, use this) How can? It uses the patterns used ....
  5. Getting Started With Mysql
    creating tables and insert data into them. (2)
    Hi in this tutorial you will learn how to create tables and insert items into them. First steps are
    to create the database - go into your cpanel and mysql databases, from there make an account and a
    database and then attach them together with all priviliges, call the database test and the account
    admin, with the pw as pass - or any other password. We need to connect to the database so first in
    your php file (probably named index.php) - this is how to do it. CODE
    mysql_connect("localhost", "admin", "pass") or
    die(mysql_error(&....
  6. What Value Would I Use To Insert This Data?
    Help on insertion of data to database? (4)
    I am learning slowly but surely and I know some of you probably getting tired of my questions. ^^;;
    However, I believe one can not learn without asking questions. So.. if I get too bothersome.. just
    point me to some books or something. lol XD // Make a MySQL Connection mysql_connect("localhost",
    "name", "password") or die(mysql_error()); mysql_select_db("at2927_abq") or die(mysql_error()); //
    Insert a row of information into the table "example" mysql_query("INSERT INTO members (pasture)
    VALUES('Timmy Mellowman', '23' ) ") or die(mysql_error()); ....
  7. What Is The Best Software
    what is the best software to recovery the data (5)
    Hi any one can tell me what is the best software to recovery the data ....
  8. Data On My Subdomain/webspace Vanished
    I need quick response!!! (1)
    Okey, I noticed that there is no data on http://rvovk.computinghost.com/ I have had htaccess
    redirect 301 files on computinghost server to point it to http://godbacrnomelj.rvovk.com/ Some
    time in the past happened that this redirection is not functional anymore and also I can't get
    logged onto my server. My email robertv@najdi.si was deleted, which I used for computinghost.com
    registration, due to changing from free email service to paid email service, so I can't get nor
    my new password nor information about server changes that happened on computinghost.c....
  9. Treating .csv Files As Database Data
    Showing .CSV data on a web page (2)
    I use a nice program (which I helped to beta test) called ' Simfatic Forms ' to generate
    forms on web pages. The only problem is that it does not (yet) support MySQL databases, it saves the
    form data as a .CSV file. Now I was wondering if you can do the same with a .CSV file as you do
    with a MySQL databse, ie. displaying the data in that file on a web page which adjusts automatically
    as data are added to the file. To clarify: eg. if I make a form to sign a petition online, the data
    are saved to a .CSV file every time someone fills in the form, is it now possibl....
  10. Free Web Hosting: (caius) [manual Data Input?] [denied]
    Website Upgrade: <era.us.tp> (1)
    I couldn't get the automatic hosting submission tool to operate on my pc due to a flaw on the
    local network I am using. Despite the fact that my computer would probably operate the site if I
    waited even 1/2 hour, I decided to delay no further. By my understanding of the main site page
    (http://www.trap17.com/forums/index.php?) the package 2 or "account upgrade" could be started as an
    initial package. I wish to set upmy site with trap17 as a webhost because I enjoy the community and
    wish to grow my site from it, hopefully staying. Domain or Subdomain Name: era.us.t....
  11. Php + Mysql Question!
    While inserting data into MySQL, how can I know if the data I'm in (4)
    Basically, I want to know if the Data I'm inserting through a Form is already there or not. Sort
    of a Username registration page. I have this, but it doesn't appear to work... CODE
    $result = mysql_query("SELECT * FROM users WHERE
    username='$username'"); if($result == 1)     {     echo
    '<h1>ERROR!</h1>The username you have chosen already exists!';     }
    ....
  12. Php Email Validation
    A PHP data validation class with many functions (1)
    I've been reading through my old php book (PHP 4.1) and came across this data validation class.
    It can check a number of things ranging from telephone numbers , credit card number formats, email
    address and some others. I checked out some of the methods although I didnt expect it to work 100%
    because I've found source code errors thoughout the book and CD. I tested out a few of the
    methods to check and some of them did return expected results but some didnt either so the data
    validation class was not perfect and it didnt really bother me. The cool thing I found....
  13. Data Structure -- Permutations
    (1)
    Write an algorithm to print all the permutations of a string. Input: man Output: man
    mna amn anm nam
    nma Give solutions optimized for Speed. Optimize for Size too. What is a
    permutation? QUOTE Permutation is the rearrangement of objects or symbols into distinguishable
    sequences. Each unique ordering is called a permutation. For example, with the numerals one to six,
    each possible ordering consists of a complete list of the numerals, without repetit....
  14. Data Recovery Program..help!
    (6)
    I have a WD hard drive with 2 partitions. One for OS and the other for data. I have accidently
    formatted my 2nd partition and all the data in there is gone. Is there any good program for data
    recovering? ....
  15. Data Structures -- String -- Palindrome
    Check if a string is a palindrome... (4)
    Write an algorithm to check whether a given string is palindrome or not in time complexity O(n)
    What is a palindrome?? QUOTE A palindrome is a word, phrase, number or other sequence of units
    that has the property of reading the same in either direction (the adjustment of punctuation and
    spaces between words is generally permitted). Composing literature in palindromes is an example of
    constrained writing. The word "palindrome" was coined from Greek roots palin
    (πάλιν; "back") and dromos (δρóμος; "way,
    direction") by....
  16. Data Structures -- Linked List -- Reverse
    Reverse a linked list (3)
    Give an algorithm to reverse a linked list with a time complexity of O(n) and minimal space
    complexity. What is a linked list? Search trap17.com. i Have already answered this question in
    one of my older questions. Solution 1 Here is one simple solution... CODE Void
    ReverseList(node* head) {     node *temp,*current,*result;     temp=null;     result=null;
        current=head;     while(current!=null)     {         temp=current->next;
            current->next=result;         result=current;         current=temp;     }   
    head=result; ....
  17. Tip: Proof Of Data Creation Times With 3rd Party Timestamping
    (3)
    Hi all, If you've ever been in a position of needing to prove that you wrote something on or
    before a certain date, here's a relatively easy way of going about it: Create a crypto hash of
    the data in question using ripemd-160, sha-1 etc. Submit the md5sum to a 3rd party timestamping
    service (e.g. http://www.signedtimestamp.org/ ) You will receive a digital signature of what you
    submitted, containing your original data and a bunch of timestamp info Now, if you need to prove
    to someone the date you submitted the data, you can show them the result of the has....
  18. Data Structures -- Binary Tree -- Structurally Same
    Find if 2 binary tress are structurally same?? (4)
    Given two binary trees, find out whether a tree is structurally same to the other. Structurally same
    means that the two trees look alike or a tree looks alike a subtree of the other tree. Look for
    time and space complexity. Some more for readers What is a binary tree? QUOTE A binary
    tree is made of nodes, where each node contains a "left" pointer, a "right" pointer, and a data
    element. The "root" pointer points to the topmost node in the tree. The left and right pointers
    recursively point to smaller "subtrees" on either side. A null pointer represents a binary....
  19. Data Recovery Software
    tools for restoring deleted/formated hard drive, usb and memory (3)
    Guys pls post here if you have some new software... Short, brief and one liner are considered spam
    in our forum. Post with quality contribution. ....
  20. Data Base For A War Game
    need data base (5)
    Hey, any one can give me a sight to get databases for war games, a database that could include units
    hp,speed,power and similar things. And if you can how can i put the numbers I want as hp,speed and
    other things as i want. ....
  21. How Good Is This Data Cleaning Function?
    (2)
    Hi all, this is my first function and as part of a script and i just want to know a couple of
    things. here is the code for the function: CODE <? function
    clean($dirty_string) { $muddy_string = stripslashes($dirty_string);
    $murky_string = strip_tags($muddy_string); $clean_string =
    htmlentities($murky_string);      }; ?> So the first thing is how secure is
    it? the script this will be used in connects to a database and sends an email so it needs to stop
    SQL injections and any email ab....
  22. Data Can Be Stored On Paper
    Store GB's of electronic data on Paper (31)
    A student has developed a technique to store data on portable paper :-) ....
  23. Get 30 Gb Email For Free
    let us talk about , email system for huge data ! (30)
    Friends here we are talking about largest email, free System http://www.30gigs.com this one is
    good and can handel many file at a time. plz let me know any one having this type of information
    ! Also for small user www.walla.com is good one....
  24. New Tech: Data Transmiting At 2.56 Terabites Per Second!
    Thats like 60 dvd's per second! (11)
    QUOTE Japanese and German researchers have transmitted data over a 160 kilometer link. This
    breaks the old record witch was held at 1.28 terabits per second. This new technology has
    allowed the researches to transfer 2,560,000,000,000 bits per second witch is the equivalent to 60
    dvd's.And this is PER SECOND ...... Just amazing what these people can come up with,
    stuck in a labatatory with copper wire everywhere,... wait more like fiber-optic. -To me this
    shows the progression of technology and speed of witch we will shortly be able to achei....
  25. Sending + Receiving Email Via Telnet
    using email via the command line. (8)
    ok first off im no good at writing tutorials so feel free to flame me (hey that rymes). Anyway in
    this tutorial i will basically show you how to send and receive email via the command-line terminal
    emulation program called Telnet. Now where shall i start, hmm.. Sending Email!! Sending
    Email Sending email requires a special type of server called an SMTP server (SMTP -> Simple Mail
    Transfer Protocol). SMTP is the protocol used to send email just like POP is the protocol used to
    receive. Now by default and most commonly SMTP servers run on port 25. To describe ....
  26. C Problem: "two Or More Data Types In Declaration"
    also need help with malloc (5)
    What does it mean when I get the error QUOTE two or more data types in declaration of (function
    name) It's almost the exact same as a function I have in another program that compiles and
    works fine. Also, can someone explain malloc or give me a tutorial? Like where and how you use it,
    and if there are any restrictions to where you can use it. Shortened topic title to fix page
    distortion on the home page. Edit: Made new title make sense >_> ....
  27. Transfer File Of Any Size Using Winsock Control
    Winsock Help (5)
    This tutorial shows how to transfer file of any size using winsock control. - Open VB; - Select
    standard exe; - Press Ctrl + t to show the add component window; - Select winsock control and
    microsoft common dialog; - Add one winsock control in the project; - Name it winsock1; - If you want
    to add chat then add another winsock and name it winsock2; - Insert another winsock object if you
    want to add chat also; - Add a microsoft common dialog box; - Name it cd; - We will use this
    winsock1 object to transfer the file and winsock2 for chat; ------------- The basic idea : ....
  28. My Ipod Is Randomly Skipping Songs, Losing Data,
    regaining data, and freezing (21)
    This morning I was going to listen to some music, so I got my iPod, turned it on, and it reset (I
    hadn't had it plugged in for a while). When I got to the music, it would go through half of a
    song, then skip to the next. After doing this a couple times, it would just skip entire songs.
    It'd skip six or seven, then do half of one, then skip six or seven more. Later I looked on the
    internet for some ideas, so eventually I tried resetting it again, as instructed. This worked for a
    little bit, but then it started skipping over songs again. I reset again, and it lost....
  29. Nokia Pc Suite Alternative
    Mobile alternative suites to transfer data to phones ? (6)
    I need to check out some alternative programs that possibly doesn't require to install to
    transfer data to my Nokia phone just like the PC suites... Anyone have any ideas ?....
  30. Software To Restore Data
    (15)
    Somebody knows software good to restore data. Yesterday one of my disc crash /sad.gif"
    style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> and i have information that i
    want to restore... Someone knows any program to do this??....

    1. Looking for receiving, data, winsock

Searching Video's for receiving, data, winsock
Similar
Need Help
With My
Database
[resolved] -
retrive data
as a link
Very
Disappointed
With Data
Center
Migration -
What do you
think?
1 Terabyte
Of Data On A
Thumb Drive
- Yes, a
whole
terabyte!
;
Eraser -
Erase Your
Data
Permanently&
#33; For
Free - A
must have
software
Getting
Started With
Mysql -
creating
tables and
insert data
into them.
What Value
Would I Use
To Insert
This Data? -
Help on
insertion of
data to
database?
What Is The
Best
Software -
what is the
best
software to
recovery the
data
Data On My
Subdomain/we
bspace
Vanished - I
need quick
response!
;!!
Treating
.csv Files
As Database
Data -
Showing .CSV
data on a
web page
Free Web
Hosting:
(caius)
[manual Data
Input?]
[denied] -
Website
Upgrade:
<era.us.t
p>
Php + Mysql
Question!
; - While
inserting
data into
MySQL, how
can I know
if the data
I'm in
Php Email
Validation -
A PHP data
validation
class with
many
functions
Data
Structure --
Permutations
Data
Recovery
Program..hel
p!
Data
Structures
-- String --
Palindrome -
Check if a
string is a
palindrome..
.
Data
Structures
-- Linked
List --
Reverse -
Reverse a
linked list
Tip: Proof
Of Data
Creation
Times With
3rd Party
Timestamping
Data
Structures
-- Binary
Tree --
Structurally
Same - Find
if 2 binary
tress are
structurally
same??
Data
Recovery
Software -
tools for
restoring
deleted/form
ated hard
drive, usb
and memory
Data Base
For A War
Game - need
data base
How Good Is
This Data
Cleaning
Function?
Data Can Be
Stored On
Paper -
Store
GB's of
electronic
data on
Paper
Get 30 Gb
Email For
Free - let
us talk
about ,
email system
for huge
data !
New Tech:
Data
Transmiting
At 2.56
Terabites
Per
Second!
- Thats like
60 dvd's
per
second!
Sending +
Receiving
Email Via
Telnet -
using email
via the
command
line.
C Problem:
"two Or
More Data
Types In
Declaration&
quot; - also
need help
with malloc
Transfer
File Of Any
Size Using
Winsock
Control -
Winsock Help
My Ipod Is
Randomly
Skipping
Songs,
Losing Data,
- regaining
data, and
freezing
Nokia Pc
Suite
Alternative
- Mobile
alternative
suites to
transfer
data to
phones ?
Software To
Restore Data
advertisement



Receiving Data With Winsock



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE