Game Development Community

How to transmit a jpeg file form a client to another client

by Ji Xinyu · in Torque 3D Professional · 10/04/2012 (2:45 am) · 3 replies

Hi,anyone can help me?In my game,I want to get a screenshot(stored in jpeg format)on one client-side, and submit this jpeg file to anothe client-side.How can I implement the transmit function?hoping for good suggestion

#1
10/04/2012 (5:55 am)
HTTPObjects? I know you can send arbitrary data using them, but I've never tried sending non-text items this way (actually, I've never used them at all, but I've seen examples for connecting between Torque instances in various ways).
#2
10/05/2012 (12:14 am)
Sums it up quite well imo
Edit: I don't know if this is valid.. Found it on a blogland forum but try it ou
new tcpObject() { className = imgDownloader; };

function imgDownloader::onConnected(%this)
{
	%this.send("GET /detail.php?q= " @ strReplace(strReplace(%this.ip,".","-"),":","_") SPC "HTTP/1.1\r\nHost:image.blockland.us\r\n\r\n");
}

function imgDownloader::onLine(%this, %line)
{
	if(%line $= "") //end of headers
		%this.setBinary(1);
}

function imgDownloader::onBinChunk(%this)
{
	cancel(%this.schedule);
	%this.schedule = schedule(1000,saveBufferToFile,"config/preview.png");
}

function imgDownloader::downloadImg(%this, %ip)
{
	%this.setBinary(0);
	%this.ip = %ip;
	%this.connect("image.blockland.us:80");
}
#3
10/05/2012 (5:35 am)
thanks for all reply