Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Amadeus

Pages: [1]
1
Window / Framerate drops from 1.6 to 2.0
« on: February 14, 2012, 06:55:56 am »
Do you compile your code with DEBUG mode or RELEASE mode?

2
System / Best way to setup GUI/TCP?
« on: November 05, 2010, 08:04:24 am »
Hi

I use on both client and server nonblocking mode and use select to handle incoming, outgoing and error stuff. Never had any lag problems on that set up.

On client side loop is about
Code: [Select]
read from server
parse data if any
do logic
send to server


server loop something like
Code: [Select]
check new connection
check and handle clients, kick out dropped etc not valid
Read data
do logic
send data


Tho I dont use sfml network pack on client or server side. Orginally both client and server was on linux side, but now on only server is on linux. Used Allegro on graphic API back then when I wrote my game.

Currently Im remaking client side with SFML and partially remaking server side.

http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html was my bible when I wrote my network code to my game.




A.

3
Network / [Solved] HTTP File download problem
« on: September 21, 2010, 07:41:29 am »
Hello

Thank you Silvah that was the problem. Sometimes it is very hard to find own mistakes :)


Cheers
Amadeus

4
Network / [Solved] HTTP File download problem
« on: September 20, 2010, 06:25:13 pm »
Hello

I did a test. Made text file that is 32 bytes and after download it was 48. Lines was not changed.

Just got hunch that enter's is converted to \r\n that would explain 16 bytes grow in file.

Original file was created in linux box before download test.

A bit annoying problem that plain binary files are affected by this too

test text file was
Code: [Select]

1
2
3
4
5
6
7
8
9
0
a
b
c
d
e
f

5
Network / [Solved] HTTP File download problem
« on: September 18, 2010, 05:44:25 pm »
Hi

EDIT: using SFML 1.6

Im strugling a little problem when using HTTP class to download files.

Currently planing to do auto updater to my little project.

I have virtual test server where I run apache www server which hosts files what clients need to update if there is changes in client side. This way I do not need to write update server from scratch.

Client are on W7 and server is on Ubuntu 10.04

But to the problem. When download a file it will have some extra bytes in it and wont work as it should.

For example dat.exe 274944 on server side (just for dummy test exe)
after download file size is dat.exe 277811

Because this file is corrupted and cannot be use as it should.

Made some tests and it seems that amount of extra bytes changes time to time.

There must be something that I dont see ;)

code snip from method which is called for update (Shortest 'working' code) stripped loggins and other not relevant lines.
Code: [Select]

bool cUpdater::bDownloadChangedFiles(const std::string _sFilename, sf::RenderWindow &_APP) {
sf::Http Http;

Http.SetHost("192.168.1.34");

std::string sURI;
std::string sDestination;
        sURI = "/" + _sFilename ;  // filename which need to update

sf::Http::Request Request;
Request.SetMethod(sf::Http::Request::Get);
Request.SetURI(sURI);

        sf::Http::Response Page = Http.SendRequest(Request);

int iFileSize = 0;

iFileSize = Page.GetBody().size() ;

// IS this right way to handle GetBody for 'binary' files
std::string sFileContainer = Page.GetBody();

// just for test
        const char * cs = sFileContainer.c_str ();

// quick and dirty save destination
sDestination = "O:\\xth\\data\\"+_sFilename ;

// Open file to write
        std::ofstream toFile(sDestination, std::ios::out, std::ios::binary);
// Using put() to write to file
for (int i = 0; i<iFileSize; i++) {
            toFile.put(cs[i]);
}
// Tested also write, but same problem
        // toFile.write((char*)&sFileContainer, iFileSize);
toFile.close();
        return true;
}



Cheers
Amadeus

Pages: [1]