Program Announcements / New Winsock2.2 Plugin - Free Multiplayer & Network Enhancement Pack for DBPro! |
| Author | Message | ||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
new: released unmanaged c++ library! download from my plugins website. new: 1.2.1 bugfix; mouse_p2p example works. UDP works! everything works new2: version 1.2.0 released! runtime startcrashs finally resolved! read change-log for further info. Hi all! I already announced in the DLL Talk that I had just recently made this easy to use and free Plugin. I would like to present the Plugin now in this Thread, as it might get more attention. For the originial post go here: http://forum.thegamecreators.com/?m=forum_view&t=73268&b=18 There you will find some benefits about the plugin. You won't be able to answer there though, since it is locked. The plugin is now in a real safe and secure state, and can be used and tested by you! That's why I actually want your attention; I'd like you to use and test it! As for now I don't see any bugs! Features - TCP & UDP support - 16000+ simultanuous connections (depends on machine) - new commands allow easy packet management - allows direct access to packet data - allows packet creation using memblock - extended debug information using the debug dll - faster execution time with the release dll (available on demand) - extended documentation and help for every single command in there! - 6 examples - 1 Tutorial so far The plugin has 60+ commands so far and is fully documented. You can access the help files with F1 if your editing cursor is above a winsock command. All the commands start with "WINSOCK" to better keep them clustered. There are two server-clients examples included in the help directory, which should help you get started. The chat server & client is easier to begin with, as it uses the easy command: WINSOCK SEND STRING If you want to get more advanced, then have a look at the other server&client example included, where you can send packets that you made up in a memblock or memory location. If you feel stuck read the help files, they might help you get along with the basic errors! And look at the examples in help/examples. Otherwise feel free to post here. Website I have put up a website where you find all stuff and links related to my plugins! http://homepage.swissonline.ch/barnski/main.htm Download I have introduced a 3digit version number now. format: a.b.c where c is incremented for bugfixes, b for new functions, and a if I extend the dll significantly. I start with 1.0.0! grab the files from my website (link just above). read the license agreement please Note: the debug version is included per default. it shows error messages if you wrongly use the dll. if you want the release dll (faster and smaller in size) ask me. Online Help View the full command help list. In the download there are additionally some examples included. http://homepage.swissonline.ch/barnski/help/winsock.htm Tutorials Beginners The Basics about Winsock http://homepage.swissonline.ch/barnski/Winsock-Basics.html Oh and before I forget, here's a screenshot of the Chat server & 3 clients in action: Here is a screenshot of the mouse_p2p UDP example in action: That's all for now! |
||
| Back to top |
|||
|
The admiral
User Joined: Thu Aug 29th 2002 Location: Cyberspace |
Thank you thank you very much ive been looking for another multiplayer plugin that might suit me so ill be testing this out and see if its good. I appreciate anyone who takes the time to make a dll for dbpro. The admiral |
||
| Back to top |
|||
|
Philip
User Joined: Sun Jun 15th 2003 Location: United Kingdom |
This is very good and a significant contribution to the DBP community! Thanks very much! Cheer if you like bears! Cheer if you like jam sandwiches! Quote of the week: "... I started learning DBP while I was a Satellite Network Controller for the US Army Space Command ... " |
||
| Back to top |
|||
|
Humanoid
User ![]() Joined: Sat Sep 20th 2003 Location: Finland |
mayby change example code little + Code Snippet while (not escapekey()) not work correct i use u6.0b2 Suomi Finland PERKELE! <AMD athlon 64 3000+> <Asus A8N-E nForce4 ultra> <GF6600LE PCI-E> <1GB ram> |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
Thanks for the comments! Is this "not" bug already reported? Anyways, I changed the example code in all files to what you posted Humanoid. next thing I will work on is a little UDP example using memblocks. -- I just started with DarkSDK, by translating DBP Projects. -- |
||
| Back to top |
|||
|
Humanoid
User ![]() Joined: Sat Sep 20th 2003 Location: Finland |
Great memblock example interesting, i dont know is 'not' bug report yet. maybe. Suomi Finland PERKELE! <AMD athlon 64 3000+> <Asus A8N-E nForce4 ultra> <GF6600LE PCI-E> <1GB ram> |
||
| Back to top |
|||
|
The admiral
User Joined: Thu Aug 29th 2002 Location: Cyberspace |
So does the server always have to listen for connections?? The admiral |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
Quote: "So does the server always have to listen for connections??
Usually the server sets one channel into the listen mode (before the main loop), and continues with its execution. In the main loop he will check if the listen channel has received a connection request. If so, then it will create a new channel that will handle the connection. The listen channel will remain open and continue listening for connections. But of course you may close it whenever you want, or open several channels that listen on several ports for con.requests!" I might make a tutorial soon that will cover the basics of winsock connections... it will include server/client and peer2peer networking methods. Stay tuned! -- I just started with DarkSDK, by translating DBP Projects. -- |
||
| Back to top |
|||
|
CattleRustler
Moderator ![]() ![]() Joined: Fri Aug 8th 2003 Location: case modding at overclock.net |
Quote: "So does the server always have to listen for connections??"
usually, thats what a server does FREE Automatic file updates for your distributed Games and Apps - see Program Announcements Forum - DBP Demo |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
Okay I promised a tutorial: http://homepage.swissonline.ch/barnski/Winsock-Basics.html This one is a short and general discussion about Winsock, meant for those who want to learn about it. The next one will be more specific about my Plugin. @CattleRustler I've been thinking of supporting your EZserver with some integrated commands, since it would be great for developers to concentrate on the client, and getting the server for free. While your server provides functionality that will suffice in most cases, it will probably only be helpful for beginners, who use the string commands to send packets (I do not expect advanced users to use string commands, as you can pack much more data using direct memory access/memblocks, and therefore reduce the bandwidth enourmously). Maybe you want to improve your server to handle binary data? instead of using seperators you could use a length indicator.. it would really improve the functionality. -- I just started with DarkSDK, by translating DBP Projects. -- |
||
| Back to top |
|||
|
CattleRustler
Moderator ![]() ![]() Joined: Fri Aug 8th 2003 Location: case modding at overclock.net |
Quote: "Maybe you want to improve your server to handle binary data? instead of using seperators you could use a length indicator.. it would really improve the functionality."
Thanks, yes, this was the plan all along (to not rely soley on strings) but I just havent had the time. I have in the past tried to provide a client dll for dbp which would handle all of the parsing etc, but since I dont code in c++ it never came to fruition. In fact the dll was done, handling all features of EZS, and doing remote client management internally in the dll - problem was that the conversion methods to get the .NET dll into usable dbp plugin form was not reliable so I scrapped the project. There have been recent developments that may make these concepts viable again - you and I should talk. Have msn or irc? FREE Automatic file updates for your distributed Games and Apps - see Program Announcements Forum - DBP Demo |
||
| Back to top |
|||
|
The admiral
User Joined: Thu Aug 29th 2002 Location: Cyberspace |
Hmm I tried it out and it seems more complex to use than it should be...cant you simplify it down to send dword or send integer etc commands because all the other dlls do it? Your average programmer isnt going to want to mess around with memory and rading all sorts of values just to get a little bit of data. The admiral |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
Quote: "Hmm I tried it out and it seems more complex to use than it should be...cant you simplify it down to send dword or send integer etc commands because all the other dlls do it? Your average programmer isnt going to want to mess around with memory and rading all sorts of values just to get a little bit of data."
I have been thinking about how to simplify the usage... Don't fear: at the end of this week I will have implemented a whole new bunch of commands to acquire this task!Quote: "you and I should talk. Have msn or irc?"
I added you on MSN and sent you an email!-- I just started with DarkSDK, by translating DBP Projects. -- |
||
| Back to top |
|||
|
CattleRustler
Moderator ![]() ![]() Joined: Fri Aug 8th 2003 Location: case modding at overclock.net |
okies, ill be on msn later today FREE Automatic file updates for your distributed Games and Apps - see Program Announcements Forum - DBP Demo |
||
| Back to top |
|||
|
x1bwork
User Joined: Wed Nov 9th 2005 Location: Cyberspace |
This is very impressive,Barnski. Barnski && Cattlerustler Question or request. Is there or could you implement options to switch on and off TCP Flags like SYN/ACK,PSH,URG,FIN,RST Ive written basic IDS tools in perl for training purposes. I'd love to write one in DBP using BlueGUI for a frontend and your sockets plugin,just to show that DBP is very capable of doing far more than just game development. example perl code(this code has been edited to prevent anyone for trying to cause any damage with it): + Code Snippet ![]() |
||
| Back to top |
|||
|
Opposing force
User Joined: Wed Aug 10th 2005 Location: England |
I have a question. Can this plugin work alongside other plugins such as multisync? |
||
| Back to top |
|||
|
The admiral
User Joined: Thu Aug 29th 2002 Location: Cyberspace |
Ok thanks thats a releif heh The admiral |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
Quote: "This is very impressive,Barnski.
Thanks, though I think I can't follow your request. I ve been spending time yesterday to find out how to set TCP flags on packets, but I think there is no way to do so. You know I am using Winsock's TCP protocol, that means Winsock makes up the IP and TCP header. Then all I add is the packet data.. the body. There is no way to change the TCP header in that way.Barnski && Cattlerustler Question or request. Is there or could you implement options to switch on and off TCP Flags like SYN/ACK,PSH,URG,FIN,RST" I could send OOB (out-of-bound) data, but I am not sure if that is what you wanted. Setting TCP flags manually results nearly in the same as coding the whole TCP protocol (unless you want to make DoS attacks). Quote: "I have a question. Can this plugin work alongside other plugins such as multisync?"
I am not quite sure what you are asking for, I see 3 interpretations of your question:1. can a dbp program that uses your new winsock plugin communicate with another dbp program that uses another winsock plugin? -Yes, since my Plugin allows you to access and change all the packet data (while soon providind some easier functions). 2. can I have both winsock plugins in the user-plugins folder of my compiler, and then only use one in my code? -Yes, I think so. Since the compiler wont link the dll that is not used. 3. Can I use both plugin commands in my code? -No, I don't think so, and besides, I do not see a reason why to do so. But maybe it works, I am not sure how winsock will react to this (you cannot mix connection commands of course, say, connect with my plugin, and then use anothers plugin to send data on that connection). Now for the new commands I am planing, here is a sketch of their functionality. Tell me if you don't like somethin. new send commands: + Code Snippet new receive commands (read commands move read cursor): + Code Snippet Some more might be added, as I see the need for... Ok, I think that these commands represent the way how you should work with packets. In every packet you will first want to write a byte or two (using the new commands) to specify the type of the packet, so that the receiver (your other program) will be able to identify the packet and know what to do with it/ what data to read from it. edit: so a sample code to receive data in a program would look like this: + Code Snippet greets, Barnski. |
||
| Back to top |
|||
|
x1b
User Joined: Sun Sep 19th 2004 Location: Cyberspace |
Quote: "(unless you want to make DoS attacks)"
No. Was hoping to write an app that would allow one to craft a tcp packet (as displayed in my perl code) then set the source and destination addresses in the headers to emulate a Blind Spoof. Just would have been a new type of app for DBP. I do appreciate that you even took the time to entertain the idea. Thanks Barnski. ![]() |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
Ok guys, I did it. I implemented a whole new bunch of commands, documented them as usual with the html help, and tested them with my new example I have added to the download pack. You can see a new screenshot in the first post. It's a Peer2Peer UDP example that transfers ones Mouse coordinates and draws points... as you can see from the screenshot I had my fun here the list of 20 new commands: + Code Snippet Oh and I updated the online (the really online) help. You can access it in my first post. You can click on each command to get full help. Maybe this helps deciding whether to download my Plugin or not. Of course the same help and all examples and even the tutorials are included in the download pack. greets, Barnski. |
||
| Back to top |
|||
|
Google Ad
AdBot Joined: Aug 26th 2002 Location: Everywhere |
|||
| Back to top |
|||
|
Heartless
User Joined: Sun Feb 8th 2004 Location: Phoenix, AZ |
Working from the examples, etc, I've noticed that I can't specify a specific address to bind a listening socket/channel to. Creating a listening UDP socket seems to default to 127.0.0.1, which isn't too useful for receiving remote data. Am I correct in my guess that you test these locally on the same machine? Could you modify 'create udp channel' to listen to '0.0.0.0' by default, and/or accept a parameter to specific the specific address to open the channel on? A machine with multiple network interfaces and addresses could then specify which specific address to listen with. This is the only caveat I've run into so far, nice work. =) |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
Thanx Heartless. I just released a new version, where you can optionally specify a local host adress, and it defaults to "0.0.0.0" now. If you specify a local host adress of "127.0.0.1" or "localhost", then your server will be only accessible from your machine. If you specify your LAN-address, then your server will only be accessible from within the LAN. If you don't specify or explicitly set it to "0.0.0.0", then your server should be accessible from anywhere. If you specify your internet-address (IP), then it will only be acessible over the internet (I think). This may not be possible though if you are behind a router (because your machine has a LAN-ip). Along with that I fixed some minor issues, and, I made the command "WINSOCK DELETE CHANNEL" to be executed in constant time. unlike the DBPro object deletion commands, this command now deletes a channel equally fast even if you have thousands of them. However, if you d like to delete all channels, you might just want to use WINSOCK MAKE again to reinitialize winsock (and automatically delete all channels before that). I hope you can test my plugin again, especially my examples, as I only did test the server.dba and client.dba. I have not tested the UDP example with my new changes, and nor did I test it over the internet. If anyone could do this and report whether it works, that would be great. I think it should work now edit; when creating an UDP channel, it is not bound to anything! You have to specifically use the WINSOCK BIND CHANNEL command to bind it. This is optional because a client does not need to bind it to a port, only the server. If it should turn out that it does not work over the internet, please notify me greets, Barnski. |
||
| Back to top |
|||
|
Benjamin
User Joined: Sun Nov 24th 2002 Location: France |
Quote: "If you specify a local host adress of "127.0.0.1" or "localhost", then your server will be only accessible from within the LAN"
Actually, localhost will only allow connections on the same computer, because it doesn't go through any network interface. |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
lol thanx benjamin, it must be the exam I am writing in an hour that confused me I will edit this now, since it is meant as a reference. greets, Barnski. |
||
| Back to top |
|||
|
Dextro
User Joined: Sat Feb 26th 2005 Location: Cyberspace |
Great plugin! By the way, can I send packets/establish a connection with the client using the native commands to a server using the dll? |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
@Dextro The native commands in DBPro use DirectPlay. Because the DirectPlay protocol is layered on top of the UDP protocol, it would theoretically be possible to use my plugin to communicate with directplay. However, I would not recommend you to investigate into this any further, since it just doesn't make sense. It's like forcing a sphere in a hexagonal cylinder... I suggest you use my winsock plugin exclusively, as it replaces all the native dbpro commands (if ur missing something, tell me), and allows you to go even further. I do understand though that the big amount of commands in my plugin threaten most people... but the clear benefit of it is the power you get over the networking, and, you are in full control of things. You just may need to dive into the materia, and learn abit first about winsock, but it will surely pay off, since what you learn using my plugin will be generally valid for networking altogether. greets, Barnski. |
||
| Back to top |
|||
|
Dextro
User Joined: Sat Feb 26th 2005 Location: Cyberspace |
Thanks for your reply. I have some experience with winsock, used with visual basic; but my main concern is about using memblocks with your plugin. As far as I understand, you can create a "memblock" packet with the WINSOCK ADD XXX command, and send it with WINSOCK SEND TCP PACKET, but what I could not understand, is how you recieve them and read them. Perhaps you could shed some light into this topic? Again, thanks for your help, and thanks for the plugin. |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
That's not too complicated: Packet creation 1. make the packet 2. fill the packet with your bytes 3. send the packet 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 to see the specific commands in action, you can have a look in my mouse udp example (just replace the WINSOCK SEND UDP PACKET with WINSOCK SEND TCP PACKET) As soon as I have more time (currently I am working on my Lua Plugin), I think I will write another tutorial. But I hope this brief summary helps to get you started! greets, Barnski. |
||
| Back to top |
|||
|
Dextro
User Joined: Sat Feb 26th 2005 Location: Cyberspace |
sorry, couldn't find a link to your mouse udp example, so my question is, what if my message is larger than 255 bytes? As far as i understand, split data will split my message into 255 byte packets, so let's suppose i send a message structured as 100 floats, 2 words and 1 byte, how would I read them if they are splitted? Thanks again and sorry for my dumb questions. |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
@Dextro Your questions are not dump at all. This is indeed a draw back when using the integrated commands. The reason for the packet length to be limited to 255 bytes is that every packet will have a length indicator stored in ONE byte, and therefore this value can not be larger than 255. I decided to do so because MOST packets do not require a more space. therefore a length indicator of 2 bytes would be a waste of bandwith in most of the cases! (I am thinkin of a MMORPG server now, as I always did when designing this plugin, where speed and bandwidth is a crucial thing) Now this limit is actually no limit at all. If you happen to have to send a longer packet, then just split it into two different ones by your self! You will see that this is a rather rare case, e.g. when transmiting a player's character information upon login. However, with my plugin you can code your own "packet" setup, by avoiding the packets command and using the other: WINSOCK SEND MESSAGE. With that command, my plugin will not send ANY other information than what you specify. Keep in mind though that you cannot mix these two sending ways! edit: The examples can be found in the download pack: help\examples\winsock\ greets, Barnski. |
||
| Back to top |
|||
|
Dextro
User Joined: Sat Feb 26th 2005 Location: Cyberspace |
Alright, so let me get this straight. If send a "message" consisting of 7650 bytes, it will be fragmented into 30 packets? Also, if i send a packet of, lets say, 3000 bytes, it would be splitted into 11 packets of length 255, plus 1 of 195 bytes? Or all the packets will be of the same length? Lets suppose I send a message with a length of 64 floats, which is equal to 256 bytes, How would I read the last float in the message? Wouldn't it be fragmented? |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
It is not fragmenting it automatically for you. If you add more bytes than 255 to a packet it will cause an assertion (error message), when using the debug dll I provide. But lets assume you want to make file transfer, then you will definetly not use the packet commands, but my other ones! WINSOCK SEND MESSAGE lets you send up to 8192 bytes at once. I haven't tried file transfer yet to garantuee that it works nicely. So I will perhaps test this and make an example. So back to your question: if you want to send a "message" consisting of 7650 bytes, and want to use the packet commands (you have to decide which commands you use for a connection, because you cannot mix them), then you have to manually split it up into 30 packets, each packet's first byte having an apropriate header byte, indicating what packet type we are dealing with... Actually, fragmentation which you are talking of, is a serious problem, when it comes to overflowing the receive buffer of a channel. the receive buffer grabs up to 8192 bytes, but if, for any reason, there is waiting more, then it will fragment the last packet. THIS is a problem because I haven't taken measures to prevent this. Normally this will not occurr (as an excuse I could say you need to program your connection better), but in the long term it is best if I add a mechanism to make sure fragmentation is impossible. I will see how soon I can address this. greets, Barnski. |
||
| Back to top |
|||
|
Dextro
User Joined: Sat Feb 26th 2005 Location: Cyberspace |
Thanks for your response, but I'm all confused lol. I guess this is what I get for programming with python. Ok, so I can receive a message of over 8192 bytes, and I can read it without splitting the packet using WINSOCK BYTE for example? |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
Nope winsock read byte is only for usage in cnojunction with the packet commands. To read the data directly you have to access the memory directly. WINSOCK RECV MESSAGE (channel) ptr as DWORD an_integer as Integer ptr = WINSOCK CHANNEL DATA PTR(channel) an_integer = *ptr inc ptr, 4 an_integer2 = *ptr ... edit or, on a byte per byte base: a_byte as BYTE a_byte = *ptr inc ptr, 1 a_byte2 = *ptr ... This is direct memory access... and you may not exceed the data len: WINSOCK CHANNEL DATA LEN. else you could cause a segmentation fault. I may be making it possible to make a memblock to copy the bytes in.... but at the moment I am not having much time. this week Im writing 2 exams, and after that I plan to go on holidays but we will see... Oh and.. there is a new update. make sure to download the new version, instead of getting the one in your web browser cache. |
||
| Back to top |
|||
|
Dextro
User Joined: Sat Feb 26th 2005 Location: Cyberspace |
Thanks again for your response. As time passes, more questions arrive, and i have a handful of them right here Well, first, what is a channel? (sorry for this dumb question, but I'm used to program network stuff with python, and to tell you the truth, I haven't seen that term before. I make mostly hacks and buffer overflows to test our own software.) As I understand it, I need to use the udp protocol for most of the multiplayer-type games. What I don't understand clrearly is how do I send a message to a specific ip address? What if i want to send it to all the clients at once? Would I have to use a for loop SEND UDP MESSAGE client, ptr, len? Second, to use the set channel target, i need to know the hostname of the client I need to send it to. That means that first I have to listen on a TCP server, when the client connects pass it's hostname and port to a variable, close the tcp connection, connect client to udp server, ... then set target channel (random channel), variable, variable2? I guess i have all this questions 'cause i don't know what a channel is, lol. Sorry for all the questions, but I'm pretty interested in this plugin, Thanks again, Billy. |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
Have you read my tutorial about the basics of winsock? there I explain briefly what a channel is. you can find it either in my first post above, or in the download->help folder. If you want to send a udp message to all clients at once (usually the server needs to do this), then you have to make a for loop, as you said. When a udp message arrives, it holds automatically the address of its sender. so you can just reply to it (you don't need to call SET CHANNEL TARGET). so there is no problem for peer2peer udp (see my mouse example). However, it seems that you just found something I haven't thought about yet. if you make a UDP server, then you need to get the remote address into a variable, because the server uses only 1 UDP channel for n clients. that means you have to set the channel target before sending things. But I need to investigate further into this. Me personally, I have only used TCP server/client so far. I never made a UDP server and haven't thought about the issues that arrise so I will add a function that allows you to get the senders host address. And I will recheck UDP functionality. edit; I think the UDP socket (channel) works like this: when you call recv message, then only a message from one sender will be returned. and after that you should retreive the remote hostaddress. then check whether there is more data waiting, and repeat the same... |
||
| Back to top |
|||
|
Impreza
User Joined: Thu Nov 7th 2002 Location: Cyberspace |
please make this dbc compatible set mipmap mode 1: set matrix texture 1,1,1: set spot light 1,0,90: set normalization on: sync rate 0: statistic(1): flush video memory autocam off: always active on: hide mouse: set window on |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
I don't have DBC nor do I know what to do to make it compatible. But if DBC is able to load a dll and call dll functions, then you can just use this string table to find out the names of the functions. syntax of string table entries: DBP_name % arguments % DLL_FUNCTION_NAME % description_of_arguments You need the DLL_FUNCTION_NAME part to call the function directly. use the description of arguments or the help to find out which arguments are needed. here is the table: + Code Snippet I hope DBC can load dll's... |
||
| Back to top |
|||
|
Phaelax
User ![]() Joined: Wed Apr 16th 2003 Location: Ohio |
Quote: "this week Im writing 2 exams, and after that I plan to go on holidays "
I hear that. Just got finished writing 29 pages myself.I'm trying to convert my java program and having some trouble sending data. It might be the way i'm trying to use pointers. Here's the error I get: Error in recv_message. recv returned: -1 [edit] problem with my string length, fixed. proper length of the expected message is now sent, but server timesout. What I need to send is "FLAPONrnrn", 10 characters. (4 escape characters, ) I'm expecting to receive 10 bytes, and should as long as the string is being sent properly. I just need to output a string as a series of bytes. If I try to use "WINSOCK SEND STRING", then I don't get any server response. I believe its to be sent out in big-endian. I'm a java guy, not pointer friendly. The data to send is correct, as i've got this working in java just fine. Ideas? + Code Snippet [edit] it finally hit me, i wasn't resetting the pointer's location back to the beginning. problem fixed. |
||
| Back to top |
|||
|
Barnski
User Joined: Thu Jan 26th 2006 Location: Switzerland, Zurich |
The error you get just indicates a forceful disconnection from the server (server closed connection). I have changed the error code information, such that it is more informative (-1 is just general socket error, but there is always a more specific code, which I have forgot to add here). But not uploaded yet. Now to your code and problem: I read your source but can't find any obviuos mistakes. I will recheck it tomorrow (evening), and try whether it is the way DBP handles pointer assignment. Besides, it was very nice to read your code, nicely structured and commented! thanx Quote: "I believe its to be sent out in big-endian"
this does not affect the message data you send. its just the header data that has to be translated from little- to big-endian. but this is done by winsock. (except of course, if your server reads binary data from what you send him, and if he uses a big-endian system) but since you send strings (byte-sequence), it is not necessary to revert anything..Quote: "If I try to use "WINSOCK SEND STRING", then I don't get any server response."
That is strange, since I can't see a reason why my plugin should treat the binary data sequence differently as the string (its the same in memory actually, with the slight difference that the string is 0-terminated, but this 0 will not be transmitted).It could be that DBPro cuts out the 13 10 13 10 in the string... I will test this tomorrow, and hopefully provide a solution |
||
| Back to top |
|||
This is a multi-page thread older than 30 days.
Go to the last page to check if you can reply to it.
Go to the last page to check if you can reply to it.
Forum Search
Enter a word or phrase to search our Forum for:
|
|





FREE Automatic file updates for your distributed Games and Apps - see Program Announcements Forum - DBP Demo


