> Date: Sat, 25 Jul 2009 20:21:39 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: multi info no messages
>
> On Fri, 24 Jul 2009, Dean S wrote:
>
> > I am using the .NET binding for a HTTP POST file upload. Once the file
> > uploads and I check multi info there are no messages. The debug and
> > progress
> > functions work, hence I know the file upload is done but I never get any
> > messages from multi info. I realise the .NET binding is old and tried to
> > use
> > a newer libcurl.dll but that didnt fix it
>
> > while ((result = multi.Perform(ref stillRunning)) ==
> > CURLMcode.CURLM_CALL_MULTI_PERFORM)
> > Thread.Sleep(100);
>
> This loop aborts when OK is returned which can't be right!?
>
> --
>
> / daniel.haxx.se
I should have posted the whole section of code, its inside another loop so if
its ok it will still continue after checking to see how many are currently
uploading and if less then 3 are add the next one from the que to the multi to
start uploading.
public void Start()
{
Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);
multi = new Multi();
int running = 0;
for(;;)
{
while ((running < MaxSimUploads) && (Que.Count > 0))
{
if (Que.Next.Parent == null)
{
Que.Next.UploadStatus = Picture.UPLOADSTATUS.UPLOADING;
}
else
{
Que.Next.Parent.UploadStatus =
Picture.UPLOADSTATUS.UPLOADING;
}
MultiPartForm mf = default(MultiPartForm); //need to free
this
mf = new MultiPartForm();
mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "format",
CURLformoption.CURLFORM_COPYCONTENTS, Que.Next.Format.ToString().ToLower(),
CURLformoption.CURLFORM_END);
mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "i",
CURLformoption.CURLFORM_FILE, Que.Next.SavePath,
CURLformoption.CURLFORM_CONTENTTYPE, "application/binary",
CURLformoption.CURLFORM_END);
Easy easy = new Easy();
if (Que.Next.Parent == null)
{
easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, new
Easy.DebugFunction(Que.Next.OnDebug));
easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);
easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, new
Easy.ProgressFunction(Que.Next.OnProgress));
}
else
{
easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, new
Easy.DebugFunction(Que.Next.Parent.OnDebug));
easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);
easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, new
Easy.ProgressFunction(Que.Next.Parent.OnProgress));
}
easy.SetOpt(CURLoption.CURLOPT_NOSIGNAL, 1);
easy.SetOpt(CURLoption.CURLOPT_DNS_USE_GLOBAL_CACHE, 0);
easy.SetOpt(CURLoption.CURLOPT_CONNECTTIMEOUT, 10);
easy.SetOpt(CURLoption.CURLOPT_URL,
"http://mydomain.com/test.php");
easy.SetOpt(CURLoption.CURLOPT_HTTPPOST, mf);
multi.AddHandle(easy);
running++;
Que.Remove(Que.Next);
}
//Check if done
if ((running == 0) && (Que.Count < 1))
break;
int stillRunning = 1;
CURLMcode result;
while ((result = multi.Perform(ref stillRunning)) ==
CURLMcode.CURLM_CALL_MULTI_PERFORM)
Thread.Sleep(100);
if (result != CURLMcode.CURLM_OK)
break;
multi.FDSet();
int rc = multi.Select(1000); // one second
MultiInfo[] minfo = multi.InfoRead();
if (minfo != null)
{
foreach (MultiInfo done in minfo)
{
Easy easy = done.EasyHandle;
multi.RemoveHandle(easy);
easy.Cleanup();
running--;
}
}
}
multi.Cleanup();
Curl.GlobalCleanup();
started = false;
}
_________________________________________________________________
Need a new model in your life? Sell your car fast.
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F866383&_t=758314219&_r=carpoint_tagline&_m=EXT