|
Have them all reply to a UDP broad cast. The broadcast can specify the ip and port which the servers should report to.
Natza Mitzi
|
|
|
|
|
I think I dont get you but are you trying to say that I should start a new server that will have all info about running servers ?
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
|
|
|
|
|
No, he is assuming you can modify the code each one is using.
He wants you to have the socket servers programmed to respond to a UDP broadcast, and you should program your client to send that UPD broadcast.
Are you able to modify the server code in that way?
Codemonkeys don't do it at all. Too busy coding.
|
|
|
|
|
Naruki wrote: Are you able to modify the server code in that way?
Why I cant ?
Well, the thing is I'm developing a pocket pc application. When you select file, right click on it(not actually) and select 'Send via wifi' then it opens my client application. But now I have to know the ip of the server to which I want to send the file and I want to write a code to search all the servers in homenetwork. Like bluetooth, when you send file it searches for another devices.
Both client and server written by me so I can modify the code
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
|
|
|
|
|
In that case, it looks like Natza's answer is what you need.
Have your client app send a broadcast UDP, which does not need an IP address. This will only go out on the local network segment (i.e., will not cross a router).
Change your servers to listen for such a broadcast packet. When they see it, they respond with their IP addresses.
How to implement that is a another thing entirely...
Codemonkeys don't do it at all. Too busy coding.
|
|
|
|
|
Ok, if you are reading this you may have seen the issue I was having with trying to us SqlDataReader(SequentialAccess) to read bytes from the VARBINARY(MAX) column. The problem was it wouldn't work with the VARBINARY column.
I have solved it using the IDataReader:
IDataReader myReader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
if (myReader != null)
{
myReader.Read();
long size = myReader.GetBytes(0, 0, null, 0, 0);
byte[] buffer = new byte[size];
int bufferSize = 255;
int dataIndex = 0;
long bytesRead = 0;
SetProgBar(Convert.ToInt32(size));
while ((bytesRead < size) && ((size - bytesRead) > 255))
{
if (bwLoadPicture.CancellationPending)
{
e.Cancel = true;
SetLabelDownload("Picture download cancelled.");
}
else
{
bytesRead += myReader.GetBytes(0, dataIndex, buffer, dataIndex, bufferSize);
dataIndex += 255;
bwLoadPicture.ReportProgress(255);
decimal FileSize = (Convert.ToDecimal(size) / 1024) / 1024;
decimal CurrentSize = (Convert.ToDecimal(bytesRead) / 1024) / 1024;
SetLabelDownload(String.Format("Downloading.. {0}MB of {1}MB", Math.Round(CurrentSize, 2).ToString(), Math.Round(FileSize, 2).ToString()));
}
}
bytesRead += myReader.GetBytes(0, dataIndex, buffer, dataIndex, Convert.ToInt32((size - bytesRead)));
SetLabelDownload("Finished Downloading.");
MemoryStream ms = new MemoryStream(buffer);
pictureBoxPicture.Image = Image.FromStream(ms);
ms.Close();
}
myReader.Close();
Now my new question is...
Is there a way to do something like this when uploading a file/picture to a database? If you are uploading a large file I would like to display a progress bar. So some how I would have to get the total bytes of the file, then write 255 bytes at a time or so. Is this possible?
|
|
|
|
|
Jacob Dixon wrote: Is there a way to do something like this when uploading a file/picture to a database?
AFAIK, providing exact progress will not be possible. You can use asynchronous method like BeginExecuteNonQuery[^] and display a progress until the callback function executes.
|
|
|
|
|
I see... so this will run it on another thread basically and I can see the start and stop points. Well I was trying to figure out how to see how much bytes have been written to the SQL database somehow. Sad there isn't something to do it...
|
|
|
|
|
hi ,
i'm creating an application that's checks if a blank dvd is inserted in the drive.
i want to prevent that my application is closed by a user using the task manager.
- i've tried to use code injection to Task manager to hide my process from the process list but this solution closes hides other processes but not mine.
- i've tried to use a windows service to verify if the application is still running and to restart it if it is closed ,but shows me the application in the process list but there is no UI.
- I tried to impersonate the code to a higher level user ,but this returns an exception because i'm trying to instanciate "MsftDiscMaster2 discMaster" : discMaster.IsSupportedEnvironment is always to false.
Thx
|
|
|
|
|
I doubt this is possible. I recall seeing this question a couple of times and the general consensus was that it can't be done. Also, your service could be disabled.
Off topic, but why do you want the user not to be able to kill your app? I would generally consider that very hostile behaviour and make sure I remove every trace of it.
|
|
|
|
|
the problem is that only the administrator could be able to close the application.
This application should record every dvd or cd burning action.
that's why i don't want the user to be able to close this application .
To burn a dvd or a cd the User should unlock the dvd burner using this application .
if i tried to run the application in the User account and there is a problem using the isolated storage and the IMAPI2 .
|
|
|
|
|
Maybe when the form is closing you could run another process of that application unless it was closed by a certain user? (Environment.UserName)
|
|
|
|
|
Well, if thats that then make a formless application, name it 'svchost'. Since too many processes have the same name, it will be hard to know which one is yours and if someone closes the wrong svchost process then I'm sure window will react strange and will require a restart. Thats the way I use...;)
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
|
|
|
|
|
since the user is not an administator , i'm managing to create a batch file that runs this application at windows startup using the runas command with Administator privilege.
This way , the user cannot stop the application using the Task manager , the UI for this application is visible and i've change the security policies to disable the regedit .
|
|
|
|
|
hi
your problem has been solved by me
i have a program that nothing can close it
and it can watch your application and when something closes it my program
will restart it agane
all you have to do is send me yor application process name(the one that apear in task maneger) and your application path (like c:\windows\myapp.exe)
mmfatemi@yahoo.com
have fun
|
|
|
|
|
I want to extract attachments from a PST or OST file from C# code and save the attachments to my local drives. I use OUTLOOK 2003 with the exchange server.
Any idea is appreciated.
|
|
|
|
|
I'd start here[^]
which should get you started.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
|
I've written some code that takes 2 or more files and joins them together into a single file, essentially duplicating the functionality you see when you use the DOS copy /B file + file + file outputfile command. The problem is that it takes what I consider an exorbitant amount of time to perform this action. Granted the source files are as big as 1gb in size, but it just seems to me that I can make this process faster, so I'm here asking for possible approaches to the problem.
Essentially, I'm opening up each source file and reading blocks of the file at a time, and then writing to the target file. Due to the total size of the target file, I can't simply read in the entire set of files at once (as big as 8gb) and then write it out all at once) I've tried 256k blocks, 512k blocks, and 1mb blocks, but they all perform about the same (no empirical data to back this up, just an "impression"). Is it better to go with reading larger blocks or smaller blocks? Anyone have any insight?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
So you're still pissing about with those videos, don't you have something constructive to do, lets see
John Simmons / outlaw programmer wrote: Anyone have any insight
yep but you should have asked for some HELPFUL insight. Well I'm off the the VB forum to see if I can annoy someone there.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Are you doing the read and write synchronously? Did you try using the asynchrounous BeginRead/BeginWrite methods?
|
|
|
|
|
For maximum performance I would:
- not use .NET File and Stream classes, instead use low-level Win32 file operations (CreateFile, ReadFile,...)
- if coding in .NET make sure all buffers are managed, and marshaling is not copying data, just passing pointers (use byte[] and GCHandle)
- try and get the files NOT cached (don't recall how that was done)
- use two separate disks, one for source, one for destination
- transfer a moderate amount of data at a time, try and make it an exact multiple of the cluster size (if unknown try 2*3*5*7*11* 64KB)
- make sure system activity is low (i.e. no other disk accesses)
and for file concatenation I hope each file's size is a multiple of your sector size (512B), if not can you accept padding? when unaligned with respect to sectors, I would compensate for that on the reading half of the code, i.e. as much as possible write at file address that are multiples of 512.
What are the copy numbers you are getting (MB/sec)? you should be able to achieve 30MB/sec on moderate hardware.
|
|
|
|
|
By passing FILE_FLAG_NO_BUFFERING to CreateFile perhaps? I never tried that, maybe it doesn't work, but it sounds like it has a chance
|
|
|
|
|
The followin code scrolls the text file contents, for a single line entry. how can i scroll the contents (in a single line) if i have more than one line in my text file ????
My main aim is to make a scrolling news application, by giving the input through a text file !!!
plz help
---mist---
------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsApplication1
{
public partial class FormMain : Form
{
Timer timer;
public FormMain()
{
InitializeComponent();
this.DoubleBuffered = true;
}
private void FormMain_Load(object sender, EventArgs e)
{
Streamreader re = File.Opentext("C://test.txt");
string input=null;
while((input=re.ReadLine()) !=null)
{
label1.Text=input;
}
label1.BackColor = Color.Red;
label1.Left = panel1.Width;
timer = new Timer();
timer.Interval = 10;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
void timer_Tick(object sender, EventArgs e)
{
label1.Left -= 1;
if ((label1.Left + label1.Width) < 0)
{
label1.Left = panel1.Width;
}
}
}
}
|
|
|
|
|
mist_psycho wrote: while((input=re.ReadLine()) !=null)
{
label1.Text=input;
}
this is reading all text and throwing away all but the last line.
You need to read and store all lines in memory first, in the Load handler. File.ReadAllLines can be used for this.
Then set your Control's Text property to whatever you want it to show; probably do this in the tick handler.
FYI: You could do without the string array, keeping all text inside the Control, but that is much harder to do correctly.
|
|
|
|