ServerSocket / Socket Write limit
Posted
#1
(In Topic #1291)
Banned
I have this program feature…..
I have a ServerSocket running and i connect my program to it. other programs can also connect to it and those connected can share data.
So for example one program will request the scores list from another user.
When requesting client-1 sends a request msg to the webserver that then sends the request to the user (client 2), then their program sends the requested data back to the server to then be sent to client 1.
The problem is this…
When using my local apache server it all works as expected and the data (quite a long string) is sent in one shot.
But, when i upload the webserver to my online server and try to use it from there I am finding my Read event is only getting some of the data, it's truncated and the rest comes through in another Read event !?
Anyone know if there Is there a way to stop that happening?
I tried Socket.Begin, Socket.Send but that didn't help.
Posted
Regular

How is the “Read …” command line ?
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Banned
vuott said
Hello.
How is the “Read …” command line ?
It was simply this…
I have been able to handle it as i know the text should end with a "}" as it's a collection setting string
If it does not end in } then it saves the currently read text to a buffer and appends each next read event to the buffer until it does end with }
like this…
Code (gambas)
- sTxt = $sBuff & sTxt
- $sBuff = ""
- $sBuff = sTxt
- ' At this point sTxt should now be a complete text and not cause the next line to error.
Would have been much easier if the Read event got all the text in one shot like it does on my local apache server.
I wondered if there's an apache setting I could use on the web server? or a header that forces read/write events to not get split.
Posted
Regular

Is this :? idea able to help you, BruceSteers ?BruceSteers said
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Regular

Posted
Banned
thatbruce said
Are you using JSON? In any way. Then beware of stuff (sorry, I have stuff that looks simillar)
no just gb.net ServerSocket.class on the web server and Socket.class on the clients.
Trying normal Socket (steam) Read / Write methods.
sending plain ascii text (basically a gb.settings style file text)
I'm guessing the data being sent in multiple Writes is a server limitation, or a setting i do not know how to adjust.
Posted
Administrator



I use them for remote managing the servers. Think remote update, check log files, restart services and the whole lot.
It is all intranet based
I have a few questions about your setup:
It seems it works in the 'intranet' setup or did you test on your localhost (so your own machine -> detail matters)?
What is the length of what you are sending?
What is the code you use for sending?
What port are you sending/receiving?
What server socket properties have you set/not set?
Just a few questions that pop up that might be of influence in understanding and solving the matter.
I've had same daemon producing different results on different servers running exact same os and configuration.
The difference being that one server threw an error that couldn't bind to the port and the other didn't. Both are running daemon v1.0 (giving error on 1 server) and the recently improved daemon v2.0 (on a different port)
Both servers and daemons did accept my connection… :shock:
Still don't know what is causing the error, but it all works on both servers at work. Daemon v 2.0 is running solo at home server.
I do know that detail really matters.
Some suggestions that might change your result/help solve the problem/give you more insight in the matter:
- Wait in code for less than a seconds can help, if you send a lot in sequence.
- Slower systems react different that faster systems, test for this and see how you can tweak, sometimes simplt changing order stuff happens
- A network sniffer having a look at what really goes on on the cable will help (specially since you send ascii you can see every package contentr in details) will give you insight in the matter.
Keep me posted on your findings, happy to think along..
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Administrator



gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Banned
I make sure the text being sent has a known end sequence.
It was a case of the local machine (localhost) working fine and sending all the text all in one shot but the online server sending it in multiple parts.
So the answer was repeatedly reading the input and adding the text to a string until it detects the end sequence.
Sorry i did not reply to your last message. it got by me. so to answer..
localhost , just apache2I have a few questions about your setup:
It seems it works in the 'intranet' setup or did you test on your localhost (so your own machine -> detail matters)?
Code
What is the length of what you are sending?Code
What is the code you use for sending?Code
What port are you sending/receiving?$hServer = New ServerSocket As "Sock"What server socket properties have you set/not set?
$hServer.Port = 8083
$hServer.Type = Net.Internet
$hServer.Listen
Posted
Administrator



I experience different behavior on different systems, all running same RemoteDaemon application using Socket server and client for 2-way communication with my manager software on my system.
It all works now, but over time needed some experimenting now and then on sending and receiving end with short wait instructions.
I also needed to start using end markers (actualy start markers) in the send info if a lot of data in sequence got send to my system. or vice versa. Sometimes seemed that the receiving end couldn' t handle the load in some situations. Start markers was part of the solution on the sending side with short waits in between 0.01 if different stuff in fast sequence is being send. I didn't have to do much on the receiving side other than have it recognize the start markers and act accordingly.
Your problems seems a likewise case, but like mine it seems you got it doing what you want it to do.
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
1 guest and 0 members have just viewed this.


