|
|
Hi All,
I am trying to develop a client/server application in which client will send images to the server.
Case 1:
Server is running on one machine that is behind a router and client is running on another machine that is behind some different router. As this communication will be on WAN (public IPs), a port is forwarded on server side router so that server can easily receive incoming UDP datagrams on that port.
UDP's maximum transmission unit (MTU) size is 64KB. It means a UDP socket should be able to transmit anything thing of size less than or equal to 65,536 bytes. When in case of the application i am developing the client is only able to send an image(UDP datagram) of 10-13k. If i try to transfer an image of the size greater than 10Kb, server is unable to receive it and server side UDP socket will be always in (receive) blocking mode.
Case 2:
Server is running on a machine that is behind a router and client is running on a machine that is behind the same router. It means client & server are on the same local area network. Even client and server are sharing the same local area network client is sending the images (UDP datagrams) on server's public IP. In this case server is able to receive any size of UDP datagram upto 64K, which is what i am expecting from my application.
I tried to run my client on different remote PCs but the result is same. Server is not able to receive a UDP datagram of bigger than 10-13Kb. If anyone can help me to deal with this situation, he would be much appreciated.
Link to the code: http://pastebin.com/f644fee71
Thanks and goodluck with your projects. Regards,
Atif
|
|
|
|
|
You only have two choices, TCP/IP if you want to seen standard images or if you insist on using UDP you will have to use an image compression algorithm that supports lost packets. Otherwise, any logic you do in an effort to support UDP will be an uphill battle trying to replicate TCP/IP but doing a poorer job.
|
|
|
|
|
Can't you just use Socket.Send and forget about MTUs and such.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Ok here is a quick screenshot, from which you can see my top of my character has been rendered over
[IMG]http://i714.photobucket.com/albums/ww146/jneul/RPG_INVENTOR8-1.png[/IMG]
I hace a RPG game which works on a 3-layered map which is split into a grid (of rows and columns)
I can get my character making to work properly on simple objects such as a tree stump (just one cell),
and it works when you are moving down, but i get this problem when i move up, here is the code below:
public ArrayList detectTilesToRedraw(Rectangle srcArea, bool bUp)
{
ArrayList pTileRedrawList = new ArrayList();
int nTop = srcArea.Y / Map_Definitions.m_nCellHeight ;
for (int i = 0; i < m_pObjectList.Count; ++i)
{
Object pObj = m_pObjectList[i];
if (pObj is ArrayList)
{
ArrayList pList = (ArrayList)pObj;
for (int j = 0; j < pList.Count; ++j)
{
Tile_Object pTile = (Tile_Object)pList[j];
Object pSubObj = pTile.getObject();
if (pSubObj is Graphic_Object)
{
Graphic_Object pGraphicObject = (Graphic_Object)pSubObj;
int nTileTop = pGraphicObject.getPosition().Y / Map_Definitions.m_nCellHeight;
if (!bUp)
{
if (nTileTop >= nTop)
{
pTileRedrawList.Add(pGraphicObject);
}
}
else
{
if (nTileTop <= nTop)
{
pTileRedrawList.Add(pGraphicObject);
}
}
}
}
}
}
Obviously i need some smarter code for when i move up as sometimes different objects are required to be drawn when the character is in different positions
modified on Sunday, August 9, 2009 7:29 PM
|
|
|
|
|
Hi,
Please use PRE tags to show readable code. No one is going to read it as is.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Ok well what I did, was that I gave every normal sprite a Z value equal to the Y of their lowest pixel, I gave the terrain and all sprites that should be flat on the ground an interpolated Z value that is for every pixel the same as the Y of that pixel, and then some things needed little hacks such as a 2-pixel Z offset and things like that.
If you do that you don't even have to sort things anymore (are you sorting them now?)
But your code is too hard to read like this, so I skipped most of it
|
|
|
|
|
its okay could i see some source code please i was thinking about doing z-order but it means pulling apart my program and re-coding it, p.s sorry about the way i posted my code.
|
|
|
|
|
you can still edit it and add PRE tags...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Sure, here's my most important draw function
public static void Draw(DrawItemBase D)
{
const float inv1024 = 1f / 1024;
int z = D.Bottom;
if (z < 0)
return;
foreach (DrawItemBase d in D)
{
d.Draw(z * inv1024, IndexedSprite);
z++;
}
if (!MouseOverHasFoundTarget && (mouseindex < 288 || mouseindex > 288 + 8))
foreach (DrawItemBase d in D)
DetectClickOnSelectable(D);
}
There are some mouse-related hacks in it, and the hardcoded 1024 that you see there is half random, it's 768 (screen height, shouldn't normally be hardcoded) + a bit of space for sprites that extend below the bottom of the screen, a Z value bigger than 1 will be clipped away.
The main point of it, is that a draw item keeps a list of draw items which have to be drawn in order (for when exceptional rendering order is required), and that normally the Z is set to the bottom Y of the sprite.
The "IndexedSprite" you see is a homemade spritebatch which uses a different vertex struct to send different information, because it's rendering indexed textures with a player index which changes the colour at some indices, and the player index is something that can vary per sprite (read pixel, use R component and PlayerIndex to do a 2d colour lookup in a texture which contains a colour palette which is different for each player), so making it a uniform shader variable would not work.
|
|
|
|
|
thank you very much for your help now i can start to re-structure my program.
|
|
|
|
|
Hello Everyone-
I am trying to build an application that connects to a telnet server and interacts with it issuing various commands. I have done this in the past and it worked relatively painlessly. This particular device I am working with today however, is using some sort of advanced feature and is sending me an authentication request as soon as I connect to it. (If I use microsoft telnet client to connect, as soon as I connect it prompts me to send my windows login information, if I say no, I am brought to a login: prompt, this is what I want to get to with my program).
I have been scouring the net and I cannot find what my response should be to this server to tell it that I do not want to use the NTLM authentication, I just want to be brought to the login: prompt. If anyone could help me I would greatly appreciate it!
EDIT: By the way, as soon as I connect, this is what I receive from the server:
FF FD 25 FF FB 01 FF FB 03 FF FD 27 FF FD 1F FF FD 00 FF FB 00
modified on Sunday, August 9, 2009 2:28 PM
|
|
|
|
|
|
If I use Hyperterminal to connect, it does not ask me if I want to send my username/password when I connect to the server, it simply connects and says Welcome to Microsoft telnet server ... login:
I am in need of whatever it is that Hyperterminal is respond to the server after the servers initial response (that appears to be putting it into dumb terminal / TTY mode). I've ran a port sniffer and I'm just not smart enough to figure it out, there is so much data being sent back and forth 
|
|
|
|
|
Normally when I program an application, I simply connect to it, send commands to the socket and listen for commands back from the socket. It has always been straightforward. This device however, has something different. When I run the packet sniffer even with Hyperterminal, every command that I send out is proceeded by a ton of hex codes. I've tried to read on the RFC of how telnet works but I am just not that advanced. I'm used to opening the socket, reading and writing to it and that's it. I can't figure out how to get the server to just respond to me with simple ASCII
|
|
|
|
|
HyperTerminal knowing about telnet protocols shouldn't be too much of a surprise. It even has some settings about Telnet...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Have you tried using this third-pary library?
.NET Telnet[^]
The source code is available here and it seems to handle the negotiation.
http://sourceforge.net/projects/dotnettelnet/files/[^]
In fact when I look through the source it appears the 0xFF was the IAC WILL TERMINAL-TYPE as decribed in RFC-930[^]
Have a look and let me know how it turns out.
Good Luck,
-David Delaune
|
|
|
|
|
|
spankyleo123 wrote: Please help
sure.
spankyleo123 wrote: catch (Exception ex)
{
throw new Exception(ex.Message);
}
this is the best way to stay in trouble: you have an Exception, and all you do is throw all the information away except for a single message line.
This would be better by several orders of magnitude:
catch (Exception ex) {
Console.WriteLine(ex.ToString());
throw;
}
BTW: you should tell your IDE to always show line numbers (see here[^]) in editor windows.
My best guess is context.Personnels is null, but I can't tell for sure as I didn't see the DataContext() constructor...
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
That does not help as it all refers to some base class constructor.
Check it yourself, I'm out of here.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I've 3 forms, the first one has a button that shows Form2 and in Form2's Load event Form3 shows.
Now the thing is that if I call f2.Show(); from Form1's button then everything works fine but when I call f2.ShowDialog(); then the Form3 get behind the Form1 even Form2 has activated. Here is the code
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.ShowDialog();
}
}
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
Form3 f3 = new Form3();
private void Form2_Load(object sender, EventArgs e)
{
f3.Show();
}
bool isJustActivated = false;
private void Form2_Activated(object sender, EventArgs e)
{
if (!isJustActivated)
{
isJustActivated = true;
f3.Activate();
bool tmp_holdValue = this.TopMost;
this.TopMost = true;
this.TopMost = tmp_holdValue;
}
else
isJustActivated = false;
}
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
this.BackColor = Color.Green;
this.FormBorderStyle = FormBorderStyle.None;
}
}
I want that Form3 should always be above the Form1...
Updated :
Correct overlap[^]
Wrong overlap screenshot[^]
as you can see the first screenshot(correct) has Form3
(Green) above Form1 but in the second where Form3 is behind the Form1(because Form2 called by ShowDialog())
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
My best guess is that you are trying to show form3 before the load event of form2 has finished. This might be confusing the display order. Wait until form2 is loaded and idle before trying to launch form3.
The code here will give you have a form loaded event to know that Form2 is ready to go before trying Form3.
Public void Form2_Load(object sender, EventArgs e)
{
Application.Idle += new EventHandler(OnLoaded);
}
private void OnLoaded(object sender, EventArgs args)
{
Application.Idle -= new EventHandler(OnLoaded);
}
Good Luck
Latest toy built for fun: Web Lens
Best feature: Full size images when using Google image search.
|
|
|
|
|
there's a Shown event for such purposes.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Ha good catch. That's what I get for stealing code from my old 1.0 framework projects....
You and your fancy 2.0 framework events... Like those will ever catch on
Latest toy built for fun: Web Lens
Best feature: Full size images when using Google image search.
|
|
|
|