Click here to Skip to main content
15,895,849 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with getting string from bytes Pin
nc3b22-Jul-07 10:49
nc3b22-Jul-07 10:49 
GeneralRe: Problem with getting string from bytes Pin
Luc Pattyn22-Jul-07 11:03
sitebuilderLuc Pattyn22-Jul-07 11:03 
GeneralRe: Problem with getting string from bytes Pin
nc3b22-Jul-07 11:20
nc3b22-Jul-07 11:20 
GeneralRe: Problem in server or client. Pin
Luc Pattyn22-Jul-07 11:57
sitebuilderLuc Pattyn22-Jul-07 11:57 
AnswerRe: Problem with getting string from bytes Pin
Guffa22-Jul-07 12:40
Guffa22-Jul-07 12:40 
GeneralRe: Problem with getting string from bytes Pin
nc3b22-Jul-07 22:58
nc3b22-Jul-07 22:58 
AnswerRe: Problem with getting string from bytes Pin
Guffa23-Jul-07 0:40
Guffa23-Jul-07 0:40 
GeneralRe: Problem with getting string from bytes Pin
nc3b23-Jul-07 0:45
nc3b23-Jul-07 0:45 
I might as well archive the project and attach it Laugh | :laugh: But anyways. I don't mindSmile | :)

private System.Byte[] buffer=new Byte[1024];


private void SetupReceiveCallback(Socket _sock)
{
	AsyncCallback receive=new AsyncCallback(OnReceive);
	_sock.BeginReceive(buffer,0,buffer.Length,SocketFlags.None,receive,_sock);
}

private void OnReceive(IAsyncResult result)
{
	try
	{
		Socket _sock=(Socket)result.AsyncState;
		int stop=_sock.EndReceive(result);
		String str=System.Text.Encoding.ASCII.GetString(buffer,0,stop);
		MessageBox.Show(str);
		process(buffer,stop);
		SetupReceiveCallback(_sock);
	}
	catch
	{
		MessageBox.Show("Out");
		this.Close();
	}
}


So? Laugh | :laugh:
QuestionSkinned Controls Pin
Mahmoud Zidan22-Jul-07 6:40
Mahmoud Zidan22-Jul-07 6:40 
QuestionListing User Accounts Pin
CeleryGod22-Jul-07 4:16
CeleryGod22-Jul-07 4:16 
AnswerRe: Listing User Accounts Pin
mav.northwind22-Jul-07 6:41
mav.northwind22-Jul-07 6:41 
Questionwhich constructor gets called first? Pin
jon-8022-Jul-07 2:40
professionaljon-8022-Jul-07 2:40 
AnswerRe: which constructor gets called first? Pin
Luc Pattyn22-Jul-07 2:52
sitebuilderLuc Pattyn22-Jul-07 2:52 
GeneralRe: which constructor gets called first? Pin
jon-8022-Jul-07 3:18
professionaljon-8022-Jul-07 3:18 
GeneralRe: which constructor gets called first? Pin
Luc Pattyn22-Jul-07 3:35
sitebuilderLuc Pattyn22-Jul-07 3:35 
GeneralRe: which constructor gets called first? Pin
Paul Conrad22-Jul-07 5:34
professionalPaul Conrad22-Jul-07 5:34 
GeneralRe: which constructor gets called first? Pin
Luc Pattyn22-Jul-07 5:46
sitebuilderLuc Pattyn22-Jul-07 5:46 
GeneralRe: which constructor gets called first? Pin
Paul Conrad22-Jul-07 5:49
professionalPaul Conrad22-Jul-07 5:49 
GeneralRe: which constructor gets called first? Pin
Guffa22-Jul-07 9:03
Guffa22-Jul-07 9:03 
GeneralRe: which constructor gets called first? Pin
Paul Conrad22-Jul-07 9:33
professionalPaul Conrad22-Jul-07 9:33 
GeneralRe: which constructor gets called first? Pin
Guffa22-Jul-07 10:11
Guffa22-Jul-07 10:11 
GeneralRe: which constructor gets called first? Pin
Luc Pattyn22-Jul-07 9:39
sitebuilderLuc Pattyn22-Jul-07 9:39 
GeneralRe: which constructor gets called first? Pin
Paul Conrad22-Jul-07 9:51
professionalPaul Conrad22-Jul-07 9:51 
GeneralRe: which constructor gets called first? Pin
Luc Pattyn22-Jul-07 9:57
sitebuilderLuc Pattyn22-Jul-07 9:57 
GeneralRe: which constructor gets called first? Pin
Luc Pattyn22-Jul-07 10:00
sitebuilderLuc Pattyn22-Jul-07 10:00 

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.