Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Amit Shef

Ranch Hand
+ Follow
since Jun 15, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amit Shef

I'm making a game like "Draw My Thing".

Now, in this game of course, a server is required, for which every person can see what the other player is drawing.

I managed to paint from one screen to another, but the problem is that the coordinates of the drawings are not the same if the dimension (WIDTH AND HEIGHT) of the screen is different.

Here's some code to begin with:

PAINT COMPONENT



Server

NOTE:

oldX, oldY, currentX, currentY are values sent from the client

6 years ago

Dave Tolls wrote:Why are there two copies of this thread?

https://coderanch.com/t/662791/Android/Mobile/Software-caused-connection-abort-transferring

You need to time this from opening your connection to the exception being thrown.
Anything else is guesswork.
And the exception on that thread is coming from the client timing out, as far as I can tell.



Do you mean to set the timeout at the beginning of the socket initialization, and when the exception is thrown, set there too?

6 years ago

Dave Tolls wrote:Why are there two copies of this thread?

https://coderanch.com/t/662791/Android/Mobile/Software-caused-connection-abort-transferring

You need to time this from opening your connection to the exception being thrown.
Anything else is guesswork.
And the exception on that thread is coming from the client timing out, as far as I can tell.



When I started this thread, I forgot this was on android, so I made one for android as well.

I will test your suggestion and I will post what's going on.

6 years ago

Dave Tolls wrote:How quickly does this timeout then?

Have you timed it (via logging possibly) from the opening of the connection in Activity_1 to the time out exception?



I set the Timeout at the beginning before I'm connecting to the socket.

For example:




I'm sorry for this inconvenience, but I don't know how to check how quickly will it timeout.
6 years ago

Les Morgan wrote:Were you able to change the timeout on both sides? The client and server suffer equally from congestion based problems. If the client thinks the server is dead, then it will reset too.




Yes, I set them both to timeout in 7 seconds. Do you think 7 seconds is enough?
6 years ago

Dave Tolls wrote:This looks like your Android client is timing out.

You can find the timeout setting for our Socket using the getSoTimeout() method and compare that to how long your download is taking.




Thanks for replying.


My socket has already a timeout for his connection (7 seconds), but it still does not help.
6 years ago
I'm making a program which transfers a file. In the process of this method, I'm getting the written error:

"Connection reset by peer: socket write error" and "Software caused connection abort"

The file's size which I'm transferring is 96MB.

(clientSocket is SSLSocket)

Client:

Activity_1 Class:



Activity_2 Class:



Server:





Error on Server:






Error on Client:


What could cause this problem to occur?

Thanks in advanced.
6 years ago
Thanks for replying.

Les Morgan wrote:
Amit,

The problem is not unique to development, it happens all the time with off the shelf applications. What I have found is that you have enough congestion that your connection has to reset due to "lost packets". You can increase the time out, and that may help.

Les



Les, I followed your suggestion, which increasing the timeout would maybe work, but the error still exists.

Paul Clapham wrote:Another possibility is that the receiving application has simply stopped receiving the data, and disconnected from the socket. That's another meaning of "socket reset by peer". It can happen if the receiver has a Cancel button and a person sitting next to it who clicks on that button.



Paul, if i understood your question, I do have in my client a cancel button, but It happens even if I'm not touching it.


Here's the error on the Server:





And here's on the Client:


6 years ago
Thank you gentlemen, I will check your suggestions as soon as I will able to.
6 years ago
I'm making a program which transfers a file. In the process of this method, I'm getting the written error:

"Connection reset by peer: socket write error"

The file's size which I'm transferring is 96MB.

(clientSocket is SSLSocket)

Client:

Activity_1 Class:



Activity_2 Class:


Server:



What could cause this problem to occur?

Thanks in advanced.
6 years ago
Thank you Stephan, i will take a look on LWJGL tutorials.

Les Morgan wrote:When I do this, I decide how many tiles I wish to display on the screen for my game, then see the size of the display area--you can get this within Toolkit API. Once I have the size of the screen it is an easy thing to divide the physical screen dimensions by the number of blocks I want along each axis. I truncate the math, integer math, and center my board in the middle of the screen.



Hey Morgan thank you very much for replying. Can you give me a quick example? I got the screen size width and height and decided that I want 20 blocks in every axis.



From there where do I go with my code?


6 years ago
Hey and thanks for the reply. Can you give me an example of handling view technology?
6 years ago
I'm making a game which requires Tile Map and I made an image that contains the tile map. In the image there will be colors drawn which then will represent where the block should be and what type of block (Grass, Stone, Sand).

For example:

--------------------------- Color DARK GRAY (#404040)

--------------------------- Color RED (#FF0000)

--------------------------- Color BLUE (#0026FF)

In my case the Color DARK GRAY with the hex of 404040 is representing my stone block.

Here's some code to begin with:

*Block size is 64x64.


My question is how can I manage to adjust the tile map which in my case is 100x100 to any screen size so it'll fit. By "fit" I mean to fit where the tiles from the image should be on the screen.

For example -

In the tile image the tiles are here which is how it supposed to be on EVERY screen:

----------------
In my screen which is 1920x1080 the tiles are here:

---------------
In screens of 800x400 the tiles are here:

----------------
I thought something like this:
It didn't worked and the game loaded slowly.

If anybody have an idea how to manage to adjust it, it'll be great.

Thanks in advance.
6 years ago
I'm trying to make a game. I'm testing on multiple computers and While i tested it I saw in a different computer which have a different screen that all the size of the components in the JFrame have changed. How can I manage to re-size components when JFrame is re-sizing?

NOTE : I saw multiple threads about this subject and none of them fixed my issue.

Let's put some code to begin with :


I'll explain a bit now.

The character panel is the main character which moves. the danger_1 , danger_2 etc.. are the spikes in the ground.

Thanks in advance.
6 years ago
My Question is as the title ,

But I'll explain it here further.

Let's say I'm calling line 2 and I'm line 1 , I want to know if Line 2 is already in a call with someone else.

Thanks in advance ,

Amit.
7 years ago