Thats good but I'm stupid for networking and the synapse is very detailed and hard
You're not stupid at all, i just think you are trying to do too much to quickly and perhaps more or less expect(ed) a ready-to-go solution (which doesn't exist as it depends on how _you_ want your communication to work for you)
The language barrier doesn't particularly help there either
Let's resume (from the other threads as well):
You are basically looking at
- the following documentation:
http://synapse.ararat.cz/doc/help/- leading to the following class hierarchy:
http://synapse.ararat.cz/doc/help/ClassHierarchy.html- to use one class in particular: TTCPBlockSocket (
http://synapse.ararat.cz/doc/help/blcksock.TTCPBlockSocket.html)
that particular class (and it's ancestory) have (at least) 4 methods that qualify for usage to address your 'problem':
- SendString (
http://synapse.ararat.cz/doc/help/blcksock.TBlockSocket.html#SendString)
- RecvString (
http://synapse.ararat.cz/doc/help/blcksock.TBlockSocket.html#RecvString)
- RecvStreamRaw (
http://synapse.ararat.cz/doc/help/blcksock.TBlockSocket.html#RecvStreamRaw)
- SendStreamRAW (
http://synapse.ararat.cz/doc/help/blcksock.TBlockSocket.html#SendStreamRaw)
Most of those functions/methods are part of the ancestor of TTCPBlockSocket named TBlockSocket
http://synapse.ararat.cz/doc/help/blcksock.TBlockSocket.html and thus are available (as well) for TTCPBlockSocket
User GetMem already helped you out with your starting code (
https://forum.lazarus.freepascal.org/index.php/topic,49853.msg363139.html#msg363139), but you never folowed up on his efforts.
I pointed to a question someone had about SendStream (and you are more than welcome to use that instead of SendStreamRaw or others) , to which the reply was use SendStreamRaw and it had a nice example.
https://stackoverflow.com/questions/30778703/lazarus-freepascal-synapse-send-file-to-tcpblocksocketYou would need to put that all together, and come up with an idea how the server and client should communicate with each other, e.g. invent your own words (strings) that can be send (sendstring) and received (recvstring) and be interpreted by the client and server and the code acting on what meaning you gave to those words.
something like a (very crude and wrong because it was based on sending byte by byte -> use a stream instead) conversation that i posted here (
https://forum.lazarus.freepascal.org/index.php/topic,49853.msg363000.html#msg363000)
(*) snippet of a imaginative communication between client and server
1) client: hello server, are you ready to accept a byte that belong to the file i am sending ?
2) server: uhm, lemme think about that.... uhm yeah, i think i am able to manage to accept a byte, which file was that again ?
3) client: allrighty then,let me pick up that byte and send it to you.... hold on there it comes, i need to retrieve it first.
4) server: oh dear, i have accepted a byte from this client, now where do i store it ? was it this buffer ? That one is full, i need to flush that buffer first.
5) client: did i already send all bytes of this file ? If so th inform the server that we did so (so it can wait for or start the next instruction/conversation) and if not then return to the top of this communication-protocol-list else continue doing something else.
The best would be to have a (solid) starting position (code-wise) where you can send strings from client to server and back again.
Then you can start implementing your (actual) "conversation"-protocol between client and server.
As user GetMem already suggested, take small steps at a time.
edit: and in case you wish to have a look at a (more or less complete) starting position with sending strings back and forth between client and server then you could perhaps have take a look at this example from user rvk:
you should be able to click the link to get to the correct post.