Click here to Skip to main content
15,920,005 members
Home / Discussions / C#
   

C#

 
GeneralA problem with changing Form size Pin
sannak7-Dec-04 1:46
susssannak7-Dec-04 1:46 
GeneralRe: A problem with changing Form size Pin
Daniel Turini7-Dec-04 4:32
Daniel Turini7-Dec-04 4:32 
GeneralRe: A problem with changing Form size Pin
Dave Kreskowiak7-Dec-04 5:12
mveDave Kreskowiak7-Dec-04 5:12 
GeneralProblems with multicast Pin
Anup_Shankar7-Dec-04 1:34
Anup_Shankar7-Dec-04 1:34 
GeneralRe: Problems with multicast Pin
Charlie Williams7-Dec-04 4:40
Charlie Williams7-Dec-04 4:40 
GeneralRe: Problems with multicast Pin
Anup_Shankar7-Dec-04 13:39
Anup_Shankar7-Dec-04 13:39 
GeneralRe: Problems with multicast Pin
Dave Kreskowiak7-Dec-04 5:06
mveDave Kreskowiak7-Dec-04 5:06 
GeneralSocket problem Pin
jtmtv187-Dec-04 1:21
jtmtv187-Dec-04 1:21 
can someone help me with this little problem. Im trying to send a few bytes at a time over the connected network. I call socket.BeginSend() to send it async-ly. the problem is when i send my data the server is recieving to much or two little information. im positive the server is working find and im pretty sure the problem lies in the IAsyncResult method called by socket.BeginSend(). Here ill include as little code as possible (since theres alot to make this work)

//i read the data here, i only want to send the ammount that //i read of by, sybolized by the variable(read)

while((read=st.Read(by,0,by.Length))!= 0)
{
StateObject ss = new StateObject(s);
ss.buffer = by;
ss.Available=read;
//send by,offset 0 so it reads from begining
//followed by only read length incase we are //near the end of the file.
s.BeginSend(by,0,read,SocketFlags.None,new AsyncCallback(sen.MainSent),ss);
//Thread.Sleep(1);
by = new byte[12];
Application.DoEvents();
}
//now for the AsyncCallback MainSent
public void MainSent(IAsyncResult e)
{
try
{
StateObject j = (StateObject)e.AsyncState;
int i = j.socket.EndSend(e);
if(i>0)
{
//if i isnt zero there is still data left to be sent.
//here is the problem, how do i tell it to only send
//the remaining bytes of j.buffer
j.socket.BeginSend(j.buffer,i,j.buffer.Length-i,0,new AsyncCallback(MainSent),j);
}catch{}
}

thnx for your time, i hope i can find help so i can just move on from this stupid issue.

p.s: the MainSent callback was wrote with the fact in mind that i would send a entire files bytes at once. but now its wrote to only send pieces at a time (in this case 12kb at a time)
~jesse

The Code Project Is Your Friend...
GeneralRe: Socket problem Pin
J4amieC7-Dec-04 2:35
J4amieC7-Dec-04 2:35 
GeneralRe: Socket problem Pin
jtmtv187-Dec-04 11:42
jtmtv187-Dec-04 11:42 
GeneralSerialize Pin
andreas_farnstrand7-Dec-04 0:59
andreas_farnstrand7-Dec-04 0:59 
GeneralRe: Serialize Pin
jtmtv187-Dec-04 1:35
jtmtv187-Dec-04 1:35 
GeneralRe: Serialize Pin
Daniel Turini7-Dec-04 4:29
Daniel Turini7-Dec-04 4:29 
GeneralProcessController Question Pin
realmontanakid7-Dec-04 0:23
realmontanakid7-Dec-04 0:23 
GeneralRe: ProcessController Question Pin
Daniel Turini7-Dec-04 4:22
Daniel Turini7-Dec-04 4:22 
GeneralRe: ProcessController Question Pin
realmontanakid7-Dec-04 4:58
realmontanakid7-Dec-04 4:58 
GeneralStrings Constants Pin
Dirso6-Dec-04 23:51
Dirso6-Dec-04 23:51 
GeneralRe: Strings Constants Pin
Robin Panther7-Dec-04 3:17
Robin Panther7-Dec-04 3:17 
GeneralJIT Pin
Amirzeb6-Dec-04 23:19
Amirzeb6-Dec-04 23:19 
GeneralRe: JIT Pin
benjymous7-Dec-04 0:46
benjymous7-Dec-04 0:46 
GeneralMessage loop Pin
akarwa6-Dec-04 22:52
akarwa6-Dec-04 22:52 
GeneralRe: Message loop Pin
Daniel Turini7-Dec-04 4:40
Daniel Turini7-Dec-04 4:40 
GeneralCustom control properties Pin
spif20016-Dec-04 22:33
spif20016-Dec-04 22:33 
GeneralRe: Custom control properties Pin
spif20016-Dec-04 23:20
spif20016-Dec-04 23:20 
Generalcount number of rows in query Pin
Stijn Goris6-Dec-04 21:57
Stijn Goris6-Dec-04 21:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.