Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Program Announcements / New Winsock2.2 Plugin - Free Multiplayer & Network Enhancement Pack for DBPro!

Author
Message
SirFire
19
Years of Service
User Offline
Joined: 4th Apr 2005
Location: North America
Posted: 5th Apr 2006 00:57 Edited at: 5th Apr 2006 01:18
[EDIT]
nvm, I just rtfm, got it now.

Yian
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 12th Apr 2006 02:01
Barnski at your site when you click on a command,there is no description page.Also could you write an example to demonstrate the sending\receiving of strings?

"hello my brother. hello and goodbye."
-black man on drugs outside a big white house
Yian
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 12th Apr 2006 02:01
Barnski at your site when you click on a command,there is no description page.Also could you write an example to demonstrate the sending\receiving of strings? thanks

"hello my brother. hello and goodbye."
-black man on drugs outside a big white house
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 13th Apr 2006 00:07
Are you refering to my help site that I put online?
http://homepage.swissonline.ch/barnski/winsock.htm
I don't see a problem with the links there..

As for an example about how to send strings, I made already the chat-example. It is included in the help\examples\winsock directory within the download pack.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 13th Apr 2006 16:51
whenever i run the server chat example app it runs fine, then i run the client and its fine but after abour 5 secs my pc starts going at 0.001fps then locks up, and my pc changes to 16colours and 640x480 and i have to reset, i would love to see what i did wrong but it rather paintstaking to test as you can understand

Halowed are the ori.
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 13th Apr 2006 20:05
Well there is nothing specific in the code as you can see that does change colors or resolution.

Maybe your PC has a general problem with 2 concurrent dbpro windows?

You could set wait key ath the beginning of both apps and see if the same happens..
I can't help you any further, since it works perfectly here on my PC!

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 13th Apr 2006 22:25
well using multisync , ive tried 1 server and 4-5 clients and have had no problems, im very sure that this error only happens once i press any key and it connects.

Halowed are the ori.
izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 29th Apr 2006 04:52 Edited at: 29th Apr 2006 20:17
well i am having problems with vb6 and this plugin. Useing your commands, it will not connect to the vb6 server...

Edit:
NVM! its working find now lol, error on the VB side, Great plugin!
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 6th May 2006 15:47 Edited at: 6th May 2006 18:32
New update uploaded:
I forgot to export the packet len command. Now it should be in.

And thanks for reporting bugs! keep going...

edit; It still wasnt correct enough.. uploaded it again.

Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 7th May 2006 17:52
Another update:

During the development of my fourth example about transfering files, I discovered some small bugs with the packet string commands. They work now as they should (also the byte cmd).

And yea, I added a new example of how to transfer files using a server and clients. However, it is not the best way to do it, but easy to understand. I will if I find the time make new commands that will allow faster data copying (not byte per byte, which is slow because of the many dll calls it needs to copy e.g. 255 bytes)

anyways, the new example is included in the download pack, which can be found in my first post.

Yyrd
20
Years of Service
User Offline
Joined: 29th Mar 2004
Location: Under some bridge
Posted: 22nd May 2006 05:11
did you say i cuold send memblocks?

i do not see any memblocks.

bytes,word,dword,int,float,str$, and what ever a LEN is
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 22nd May 2006 22:49 Edited at: 22nd May 2006 22:54
Have a look at

WINSOCK SEND MESSAGE a_channel as Dword, memory_ptr as Dword, data_len as Integer

and

WINSOCK COPY CHANNEL DATA a_channel as Dword, memory_ptr as Dword


to get the pointer of a memblock use: GET MEMBLOCK PTR memblock_nr

Maybe reading the help files for the commands will help too.

len = length

An example:


With the last command you have to make sure that your memblock is big enough for the data you want to receive... this can be checked using WINSOCK CHANNEL DATA LEN(my_channel).
Hope this helps!

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 27th May 2006 16:43 Edited at: 27th May 2006 21:02
Your plugin rocks! lol I have made over ten diffrent programs with it now. Every thing from chat programs, database programs, movement control.

Works like a charm. Thanks alot! hopeing for new updates!

But!

i have one question. You may not can awnser it..:

I'am working on a health bar, and i wish to know how to spilt a packet? can you spilt a pachet useing your plugin? For example: i wish to send from my vb program this packet "sub_hp 10" and useing that it would go to the sub hp function/sub and take away from that varible 10. How would i go about doing this?

or do i just have to program each number useing this code:
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 27th May 2006 23:33
Are you sending Strings?
If so then you have to parse your string.
e.g. you send "sub_hp 10" as a string, when you receive it, you take the first word (all the char until you find a space), check it within a select case statement (select case "sub_hp"), and then in that case you get the number from the rest of the string, val("10") -> 10. and you subtract this value from H: H=H-val(rest_of_string).

If you are sending binary data it is different, as you wont have to parse the string.. binary simply means instead of treating the data as a string (array of chars), you treat it as a byte-array. (which is the same in memory). YOu would then not use "sub_hp" as a message header, but an int, e.g. sub_hp = 10, and you write this value into the first byte of the message. in the second byte you write the amount of hp you would like to subtract.

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 28th May 2006 00:08 Edited at: 28th May 2006 00:11
And how would i code that?, i am sending string.

here is the sub:

...sory to bother you
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 28th May 2006 13:26
First you need to write a function that returns the first word of a string. e.g. of "hello world" it returns "hello". See in the string/text commands of DBPro for help.

Then you make it as you had it in your code:


but instead of ifs you can use select:


Better you look into the DBP help for the exact syntax..

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 28th May 2006 15:33 Edited at: 28th May 2006 16:08
oh you so write the code about the same way you write in vb6..

Thank you very much!!

Edit:
the correct santax is in the text commands in help.


The first digits will have to be 6 long so every thing i add will have to be 6 or it wont work

The values will have to be 3
Yian
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 2nd Jun 2006 10:37
great work Barnski!!
however I had a problem when testing the chat example.When I exit the server ,the client says server disc'd you gracefully etc... but the nwhen I press any key to exit the program just minimizes and I must forcefully close it from taskman!

A study done by William Speyer, who was a victim of prison rape in 1989, shows that 34% of [prison] rape victims released from prison become child molestors.
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 2nd Jun 2006 21:12
I just tested it as you described, but the program does close on my PC. It is visible in the taskbar for 2sec but then it disappears. But this could be randomly.. due to the fact you had to open several dbpro applications. Or maybe due to the closure of the sockets.

What versions are you using of Win, dbpro, winsock, my_plugin ?

Does it happen everytime or was it only once?

Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 2nd Jun 2006 21:27
I retried it with two chat clients and then I experienced the same problem as you Yian.
Sometimes one app disappears. but it is randomly. Maybe this is a dbpro bug due to opening several dbpro apps on the same machine at the same time(normally you will not do this anyway).
Maybe it is in conjunction with my plugin (or plugins in general).
Maybe it is some resource that cannot be freed (e.g. sockets).

I will have a look at that.

Yian
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 2nd Jun 2006 22:04
thank you for the fast reply,Barnski!
I'd like to say that this was always when I was test with a server and client running on my pc(testing 127.0.0.1),but not any other additional clients.I have the latest DBP and the latest version of your plugin as well.
thx again

A study done by William Speyer, who was a victim of prison rape in 1989, shows that 34% of [prison] rape victims released from prison become child molestors.
wh1sp3r
20
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 13th Jun 2006 11:20
um . i have problem i uses TCP coonection and Iam sending string message to server. Server this message reads as packet


But winsock read string$() returns my text witnout first letter and after my text is .. jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj :S

Iam on good way or iam in another forest

PS: Real programmers aren't afraid of math!.

☺☺ AthlonXP 2500+, Ati Radeon 9600 128MB, dualDDR 512MB 400Mhz CL3.0, SB LIVE!, monitor 19" ☺☺
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 14th Jun 2006 18:35 Edited at: 14th Jun 2006 19:09
Your code is ok, there is just a problem with mixing packet and string commands.
If you want your server to read the incomming data as packets, you also have to use the packet command when sending the data.

So instead of directly using winsock send string,
you have to use:
winsock make packet
winsock add string
winsock send packet.

(please check the help files for correct syntax, I don't know everything by heart )
Then you can retrieve the information correctly with your server code. Besides: when "winsock channel data len" is equal to 0, then the other side has disconnected.

Quote: "But winsock read string$() returns my text witnout first letter and after my text is .. jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj :S"

This is because when using the packet commands, the first byte (=char) is used for the length of the packet, and then the rest is printed out until this length is reached (which is this garbage output of ...yyyyyyyyy...).

------------
@Yian
With the newest compiled version (of some minutes ago), I cannot reproduce the behaviour you described with the chat-example anymore. I have uploaded it. If it still happens, then it must be something with your PC, or, with the newest dbpro (I am using 5.9 )

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 29th Jun 2006 05:51 Edited at: 29th Jun 2006 05:54
sorry to bother you but i keep getting a runtime error when i try to send out a packet. Here is the error:

Its a microsoft visual c++ runtime library error

here is the error in a screen shot:
http://img518.imageshack.us/img518/9247/errors4fs.png

if it helps i am sending packets out to a visual basic program
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 30th Jun 2006 00:18
Let me give you a general explanation what this "error" message means.

Assertions (or Design by Contract)
Assertions are present in the debug version of the dll. They are not errors, but indicate that YOU, the coder, did something wrong. An assertion has an expression which has to be evaluated to true during execution (mostly at the beginning of a command execution). If it is false, then the assertion message is shown.
The important part of the message is the Expression: part.
this line shows what expression did not evaluate to true.

As you can see in your example, the connection is not open! You obviously did something wrong when connecting, or missed that the connection failed.


In the release dll (which I haven't provided yet), the assertions are disabled. There is no check done before sending data whether a connection is open or not. This results in an increase of speed, but you have to make sure you tested your program with the debug version.... This is how its meant to be used!

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 30th Jun 2006 01:49 Edited at: 30th Jun 2006 02:03
Sorry, i was trying to send packets but i just need to winsock send string insteed of make packet, add string, send packet. Thanks for the help, and again great winsock plugin
Yian
20
Years of Service
User Offline
Joined: 16th Jun 2003
Location: Nicosia, Cyprus(the Greek half)
Posted: 30th Jun 2006 03:14
Barnski thank you for the reply!
I am indeed using the latest version of DBP.

What is happening to them[the children] is the only thing they've known. The whole system of values is turned upside down: a child is appreciated and loved if it earns money by stealing
Graphiboc
17
Years of Service
User Offline
Joined: 16th Jun 2006
Location:
Posted: 30th Jun 2006 17:23
Barnski can you add me to msn? i have a lot of questions to ask you

my program crash every times without any error message :/ and i didn't understand everything i think ^^"

Sry for mybad english
Graphiboc
17
Years of Service
User Offline
Joined: 16th Jun 2006
Location:
Posted: 1st Jul 2006 09:44
hi!
i localised the problem
i make three packet, with data, and i send them to the client (from the server).
the client receive the message and the three packets but the packets don't contain any data! message len() return 0!
is it normal?
thanks to help me

Sry for mybad english
Graphiboc
17
Years of Service
User Offline
Joined: 16th Jun 2006
Location:
Posted: 1st Jul 2006 10:14
i missed to post the code...sorrry for my triple post >.<

the server code wich send the three packets when a new client come


the client code which receive the three packets...


Sry for mybad english
izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 1st Jul 2006 19:27
If i could give u a suggestion:

I use just winsock send strings snice sending packets is kinda hard. I send strings out useing the winsock send string command then on the client side i will break apart the strings (if needed) by useing text commands (len,right$,left$,mid$,etc.) Then you can write commands based apon what you recive on your client side.

example:
Server sending:

client reciveing:
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 2nd Jul 2006 01:55
@Graphiboc
Your code looks alright to me.
I added you to MSN, such that we can resolve that issue.
I have time in the evenings (european time).

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 7th Jul 2006 08:23 Edited at: 7th Jul 2006 08:23
hey Barnski, is their a limit on how many digits with the command winsock recv string? I am sending a large string packet and it gives me a crash when the client recives the large packet
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 8th Jul 2006 10:51
How large is "large" ? how many bytes (characters)?

In general the "packets" have a limit of 8kb.
maybe for string you should only use 255 bytes(characters).
not sure if I did a limitation there...
if you are in these bounds there shouldnt be a problem.

if there is still a problem then try to use the copy data to memblock command, and read the string from the memblock (then you can read byte per byte and check how far the string is transfered correctly...)

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 8th Jul 2006 18:30 Edited at: 8th Jul 2006 18:31
it was around 480 char large packet, i split the packets down and sent 4 packets of 120 insteed of one packet of 480 and it works great!.
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 13th Jul 2006 20:47
New Update Available

As usual see my first post.

I added finally the necessary commands to retrieve information about a UDP sender, such that you can reply to him.
For a howto you can have a look at the udp_sender example located in the help\examples folder in the download pack.

Also, take a look at the winsock help page, I revised it a bit and should provide more overview about which commands to use for which purpose.

Sergey K
20
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 16th Jul 2006 15:44
hey.. i got a question about that packet sending thing.

i seen the CLIENT example for getting the packet. but im not sure i understood it well.

anyways, whats the commands to see if there is new packet or so.
in the client, im sending something like:


how do i getting this in the server?

MyNewSite:http://gogetax.com
Forums(About BLO and more):http://gogetax.com/forum
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 16th Jul 2006 20:09 Edited at: 16th Jul 2006 20:11
New Update Available

I fixed a bug that SergeyK discovered; "winsock add dword" was not exported in the dll (stringtable).
(note: you could use "winsock add int" as well, or for short ints you can use "winsock add word". what matters is the amount of bytes, not whether it is signer or unsigned. The exception to this is the float, where you have to use "winsock add float")

@SergeyK
here is a quick summary what to do on the receival side (copied from one of my posts on the first page):

Packet receival
1. recv message (allows channel to store the data)
2. split data into packets
3. while packet count()>0 do...
4. fetch packet (removes first packet from list and you will now operate on this packet)
5. get the bytes in the packet.
6. return to step 3 if packet count()>0


The most important things when using the inbuilt packet commands are:
1. packets have a limit of 255 bytes
2. you need to specify the type of the packet such that at the receiver side, you know what to do with it (what data to read out).

(note that point 1. is not valid if you use memblocks for sending data, there the limit is (8*1024bytes) = 8000+bytes
calculated in mind this is... about... 8192 bytes
BUT I can change this limitation if you want me. I can make it up to 64kb. but this is not needed actually ( I think )...

Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 30th Jul 2006 00:39 Edited at: 30th Jul 2006 01:58
New Update Available

I am sorry I introduced an error in the last update, which made dbpro compilation impossible (winsock add dword was exported twice). This is fixed now, and you should be able to finally use the add dword command

PS; download link is in the first post!

PPS: I made it compatible with 6.2b it works for me, please test it!

Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 6th Aug 2006 14:38 Edited at: 6th Aug 2006 14:38
New Update Available

Basically it is just a recompilation with the new VS2005 C/c++ compiler. The dll is now multithreaded.

The dll size has been shrinked from 260kb to 100kb in debug mode, and in release even down to 25kb.

I hope the new compiler has not introduced any bugs, a first quick test was successful.

(edit; the download link is on the first post)

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 9th Aug 2006 10:05 Edited at: 9th Aug 2006 10:05
could u make a get local ip command? that would be helpfull....
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 9th Aug 2006 21:42
Quote: "could u make a get local ip command? that would be helpfull.... "

What do you want it for?

you can retrieve your local ip configuration by running "ipconfig" from cmd line, or if you are behind a router or switch, you can visit some web sites that display your internet-ip, as [href]www.whatsmyip.org[/href] for example.


Anyways, if its about preventing to do the check manually, then it might be reason enough.
I will make two commands, or one with a parameter; one returns the local ip, and the second returns the internet-ip (might be the same, the first is only used for LAN).
is that okay?

x1bwork
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 9th Aug 2006 21:53
Quote: "Winsock Make Packet
"


Really wish you had the option to really craft the packet, headers, flags,SEQ/ACK,etc

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 9th Aug 2006 21:58 Edited at: 9th Aug 2006 21:59
well i would like to have a retrieve local ip from clients

for example:
lets say i have a chat service useing dbp for the server and client. A user is trying to connect with a username and pass yet that user's other account is baned from the service,and he himself is banned. Now useing a "winsock get local ip" i could send his local ip along with his login request packet and be able to write a if function that would block him for his ip matches with ips that i have blocked.
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 9th Aug 2006 22:27 Edited at: 9th Aug 2006 22:30
Quote: "Really wish you had the option to really craft the packet, headers, flags,SEQ/ACK,etc"

Sorry, wont do that for this plugin. That would be well worth an additional advanced plugin.

Quote: "well i would like to have a retrieve local ip from clients"

Now I see. well for your example it makes more sense if the server gets the client ip out of the packet header.
Every packet that is sent over the internet in IP format, has the source and destination IP-address in its header. So you don't need to send it, but I need to add a command to get the remote address. I did it for UDP, but forgot it for TCP.
Its better anyways than to rely on the client to send its ip in the body of the packet. After all IF the client is bad and evil he could be cheating and use another client-program that sends another IP....
Do you agree?

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 9th Aug 2006 23:09 Edited at: 9th Aug 2006 23:09
that sounds prefectly logical to me

and if you think i got that from star terk you are very wrong
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 9th Aug 2006 23:28
New Update Available

Okay its done: Now you can get the ip address of your remote partner also for TCP channels. The commands are the same for TCP and UDP.

I renamed two commands:
winsock udp sender host$ -> winsock remote host$
winsock udp sender port -> winsock remote port




Quote: "and if you think i got that from star terk you are very wrong"

I don't think anything could you test the command for TCP?
I only tested it for UDP legacy (with the included UDP sender example).

Grab the download from my first post!

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 10th Aug 2006 01:02 Edited at: 10th Aug 2006 01:08
hmmm well now i am getting a windows: "send error report" every time i try to run a program useing ur winsock commands :X programs that worked before i updated.

this is the first time i updated snice i started posting on this thread ... i think... i was meaning to get around to it but never did .... sorry :s
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 10th Aug 2006 20:45 Edited at: 10th Aug 2006 21:28
I tried it on my laptop and it works, even with dbp 5.8.
so it works for me with 6.2b and 5.8 on two different machines.

Maybe you did not extract the zip correctly? just extract the content into the dbp folder...

MAYBE it is the "winsock make" command. I changed it some updates ago to handle several winsock versions. It should automatically find the best version. try "winsock make 2,2" as this was the previous behaviour of the command.

Anyone who has problems, or/and solved them, please report, as it could be helpful! Also why not reporting if it works, people only complain when something does not work, but I never hear "the update is working nicely".. so it could look like the plugin is crap, which I hope is not the case... Thanks!

edit: please add your system specs and installation versions! e.g.: dbpro version, other plugins used in the project (or just installed), Windows version, CPU type, directx? and version of ntdll.dll (size and last modified)
please also check if the examples run (located in help/examples/winsock)
Thanks!

izaboo
19
Years of Service
User Offline
Joined: 29th Jan 2005
Location:
Posted: 11th Aug 2006 01:40 Edited at: 11th Aug 2006 01:41
no the plugin is not crap i use it alot and made lots of good stuff with it this is the only time its done this to me

My Lappy has:
P4 Centrino 1.8ghz
1.5gb DDR3 ram
80GB SATA HDD
Video:
ATI Mobiltiy Radeon X300 (128mb, PCIX16)
Running:
Windows XP Home and Pro (i only have DBP on Home)
DBP 1.062
Driect X 9 June 2006 Latest
Its crashing on the Example projects as well and i did change winsock make into winsock make 2,2 - yet nothing
i did extract it with WINRAR but i think i extracted the other version with it too

Login to post a reply

Server time is: 2024-04-17 00:02:03
Your offset time is: 2024-04-17 00:02:03