borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Login to Remote computer on UNIX from windows PC)Next Topic (Can a pc in a LAN use as a server?) New Topic New Poll Post Reply
AndreaVB Forum : Network : Very important question in winsock <Important>!!!1
Poster Message
Slim Shady
Level: Scholar

Registered: 11-01-2005
Posts: 46

icon Very important question in winsock <Important>!!!1

This Problem is killing me!!
note: I don't speak english very well

ok let's begin:
if i want tot send text1.text from client to a server...

client:
wskclient.senddata text1.text

server:
dim data as string
wskserver.getdata data
text1.text=data

ok so far it's all cool
but what if i tried to put 2 text box in the client

Client:

command1_click
wskclient.senddata text1.text

command2_click
wskclient.senddata text2.text

Sever:

wskserver_data arrival
dim data as string
dim news as string

wskserver.getdata data
text1.text=data
wskserver.getdata news
text2.text=news

did uoi know what i mean
if you didn't
i want plzzzz to do this for me (if you did it the problem then will be solved)
make for me a client and server
in the client put 2 text box and 2 command button

and in the server put 2 text box

in the command1 in the client make the program send the text1.text to the text1.text in the server

and in the command2 button do the same thing with the  text2

i hope that you know what i mean!
plz help me cause this problem is killing me!

[Edited by Slim Shady on 11-01-2005 at 12:59 PM GMT]

11-01-2005 at 12:56 PM
View Profile Send Email to User Show All Posts | Quote Reply
BRMC
Level: VB Lord


Registered: 28-11-2003
Posts: 210
icon Re: Very important question in winsock &lt;Important&gt;!!!1

Hi,

try this one:



wskserver(0).getdata data
text1.text=data
wskserver(1).getdata news
text2.text=news



Bye


____________________________
I don't mind not going to heaven
As long as they've got cigarettes
in hell

11-01-2005 at 03:09 PM
View Profile Send Email to User Show All Posts | Quote Reply
Slim Shady
Level: Scholar

Registered: 11-01-2005
Posts: 46
icon Re: Very important question in winsock &lt;Important&gt;!!!1

if you mean like that:

Client:
wskclient(0).senddata text1.text

Server:
dim news as string
wskserver(0).getdata news
text1.text=news

it didn't work

11-01-2005 at 11:21 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Very important question in winsock &lt;Important&gt;!!!1

Try having two winsock controls listening on different ports. This way you will know how to distinguish which data is sent (text1 or text2).

____________________________
If you find the answer helpful, please mark this topic as solved.

12-01-2005 at 01:43 AM
View Profile Send Email to User Show All Posts | Quote Reply
Slim Shady
Level: Scholar

Registered: 11-01-2005
Posts: 46
icon Re: Very important question in winsock &lt;Important&gt;!!!1

But i want one port to be open...
there isn't any way else??
any way thanx for your helps..

12-01-2005 at 05:00 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Very important question in winsock &lt;Important&gt;!!!1

If there will be two texboxes, on both sender and receiver side, then you can, for instance, add a prefix "1" when sending data from Text1 and "2" when sending data from text2. And on receiver side check for prefix to see where it should be displayed. This way wou will need one winsock and one port only.

____________________________
If you find the answer helpful, please mark this topic as solved.

12-01-2005 at 11:32 PM
View Profile Send Email to User Show All Posts | Quote Reply
Slim Shady
Level: Scholar

Registered: 11-01-2005
Posts: 46
icon Re: Very important question in winsock &lt;Important&gt;!!!1

Thx fo ur help man.. but i didn't understand very good what did you mean..can you send me a practicale exemple... if you can't that's Ok no problem thx again for ur help

13-01-2005 at 02:09 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Very important question in winsock &lt;Important&gt;!!!1

Let me explain better:

When sending data from textbox1, send with prefix one

Winsock.senddata "1"  & text1.text

When sending data from textbox2, send with prefix one

Winsock.senddata "2"  & text2.text

When you received that, check for prefix

if left(news,1)="1" then
    text1.text=mid(news,2)
else
    text2.text=mid(news,2)
endif



____________________________
If you find the answer helpful, please mark this topic as solved.

13-01-2005 at 03:50 PM
View Profile Send Email to User Show All Posts | Quote Reply
doup
Level: Scholar

Registered: 16-06-2004
Posts: 32
icon Re: Very important question in winsock <Important>!!!1

client side i think the other way is to concatinate the text from 2 textboxes and asign to a string variable;

eg:
client
dim strVariable as string

strVariable =text1.text & "|"& text2.text

' the | used as delimiter 2 sepalate the 2 data to the server side
winsocket.senddata strVariable


sever side
'declare array which will hold ur data after split them

Dim myArray() As String
winsocket.getdata mydata
myArray=split(mydata,"|")


'here u have text1 into myArray(0)
and text2 into myArray(2)

hope it help
peter


[Edited by doup on 26-01-2005 at 03:17 PM GMT]

[Edited by doup on 26-01-2005 at 03:19 PM GMT]

[Edited by doup on 26-01-2005 at 03:26 PM GMT]

____________________________
peter

26-01-2005 at 01:14 PM
View Profile Send Email to User Show All Posts | Quote Reply
OnlineGuy
Level: Graduate


Registered: 18-02-2004
Posts: 9
icon Re: Very important question in winsock <Important>!!!1

You could also do:

Dim strData as string

Select Case (strData)
   Case "1"    'or any other ascii sign or letter
           txtField1.txt = strData
   Case "2"  
           txtField2.txt = strData
   Case "3"  
           txtField3.txt = strData
    .
    .
    .

   Case strData = "n"    'any other number
           txtFieldn.txt = strData
End Select


[Edited by OnlineGuy on 24-05-2005 at 05:16 PM GMT]

____________________________
- OnlineGuy -

24-05-2005 at 04:13 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Network : Very important question in winsock <Important>!!!1
Previous Topic (Login to Remote computer on UNIX from windows PC)Next Topic (Can a pc in a LAN use as a server?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder